Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Database Migrations in PHP (Posobota #66)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Vladimír Kriška
October 25, 2014
Programming
160
0
Share
Database Migrations in PHP (Posobota #66)
Vladimír Kriška
October 25, 2014
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
170
Design a REST API you will love to work with
ujovlado
0
800
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
520
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
420
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
180
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
130
CSS Flexbox (WebElement #35)
ujovlado
0
200
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
200
Don't underestimate CSS (WebElement #30)
ujovlado
0
640
Other Decks in Programming
See All in Programming
脅威をエンジニアリングの糧にして――現場編 / Turning Threats into Engineering Fuel — Field Edition
nrslib
0
190
SPMマルチモジュールで テストカバレッジを取得する技法
yosshi4486
0
120
JavaDoc 再入門
nagise
0
160
AI駆動開発で崩れていくコードベースを立て直す
kyoko_nr_nr
1
390
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
300
プロパティの順序で型推論が壊れる!? TypeScript6.0の修正からContext-Sensitivityの仕組みを追う
bicstone
2
1.2k
分析エージェント精度向上における データアナリストの役割
oura_shoya
0
120
Old Dog, New Tricks: The Java 25 Reinvention - JNation
bazlur_rahman
0
130
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
870
[KCD Czech] eBPF Meets the GPU: Future of AI Infra Observability
doniacld
0
110
ふつうのFeature Flag実践入門
irof
6
3.1k
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
330
Featured
See All Featured
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
200
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
1.5k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
390
Prompt Engineering for Job Search
mfonobong
0
320
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
820
Discover your Explorer Soul
emna__ayadi
2
1.1k
Fireside Chat
paigeccino
42
3.9k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
510
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
580
Making the Leap to Tech Lead
cromwellryan
135
9.8k
How to train your dragon (web standard)
notwaldorf
97
6.6k
Transcript
Database Migrations in PHP Posobota #66 Vladimír Kriška @ujovlado
My experience • Paradox: first company I worked with was
the closest to migrations • Then it went only worse • no migrations • single file migrations • Yii framework database migrations
Pros • Exact version of schema with creation and application
date • CLI interface (automation) • Easy rollback, going through history
Cons • Need to regenerate/change model
Other options/ideas • Generate migrations directly from model (no SQL
writing) • With each change create DB dump with file per table, than version in Git
Other tools • Phinx • Sqitch (Perl) • Doctrine, Phalcon,
Propel, CakePHP • and many others …
Migrations in Yii • Two main commands • yiic migrate
up • yiic migrate down • And also: history, new, to, mark
Example • let’s do some shit …
Tips/tricks • DB schema has to be versioned - no
matter how • If you don’t know how to do it, choose solution from some framework • Don’t write own tool for migrations • Start with migrations ASAP
• Always write down migrations • Try to avoid shortcut
methods (they disallow c&p from migration) • Don’t mix schema and data migrations • Write short migrations • Don’t change applied migrations
THE END Thanks!