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
Vladimír Kriška
October 25, 2014
Programming
0
120
Database Migrations in PHP (Posobota #66)
Vladimír Kriška
October 25, 2014
Tweet
Share
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
110
Design a REST API you will love to work with
ujovlado
0
740
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
470
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
370
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
130
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
86
CSS Flexbox (WebElement #35)
ujovlado
0
150
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
160
Don't underestimate CSS (WebElement #30)
ujovlado
0
580
Other Decks in Programming
See All in Programming
型で語るカタ
irof
1
870
LLMは麻雀を知らなすぎるから俺が教育してやる
po3rin
2
1.4k
リッチエディターを安全に開発・運用するために
unachang113
1
310
構造化・自動化・ガードレール - Vibe Coding実践記 -
tonegawa07
0
160
What's new in Adaptive Android development
fornewid
0
130
階層化自動テストで開発に機動力を
ickx
1
440
オンコール⼊⾨〜ページャーが鳴る前に、あなたが備えられること〜 / Before The Pager Rings
yktakaha4
2
1.2k
Amazon Q CLI開発で学んだAIコーディングツールの使い方
licux
3
130
AIのメモリー
watany
11
1.1k
プロダクトという一杯を作る - プロダクトチームが味の責任を持つまでの煮込み奮闘記
hiliteeternal
0
300
Advanced Micro Frontends: Multi Version/ Framework Scenarios
manfredsteyer
PRO
0
120
コーディングエージェント概観(2025/07)
itsuki_t88
0
450
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Language of Interfaces
destraynor
158
25k
For a Future-Friendly Web
brad_frost
179
9.8k
Designing for Performance
lara
610
69k
Building Better People: How to give real-time feedback that sticks.
wjessup
367
19k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.9k
A Modern Web Designer's Workflow
chriscoyier
695
190k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.9k
4 Signs Your Business is Dying
shpigford
184
22k
[RailsConf 2023] Rails as a piece of cake
palkan
56
5.7k
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!