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
170
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
180
Design a REST API you will love to work with
ujovlado
0
810
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
530
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
430
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
190
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
140
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
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
460
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
480
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
140
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
その節約、円になってますか?
isamumumu
1
640
Embedded SREと共に達成した会員管理システムのAWS移行 - SRE NEXT 2026 ランチスポンサーセッション
niftycorp
PRO
1
3.3k
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
160
React本体のコードリーディング
high_g_engineer
1
120
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
120
PHP Application における Kubernetes 内 gRPC 通信
ganchiku
0
570
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
継続モナドとリアクティブプログラミング
yukikurage
3
670
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.8k
So, you think you're a good person
axbom
PRO
2
2.1k
Making the Leap to Tech Lead
cromwellryan
135
10k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Abbi's Birthday
coloredviolet
3
8.9k
Mind Mapping
helmedeiros
PRO
1
290
First, design no harm
axbom
PRO
2
1.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
450
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
230
How to make the Groovebox
asonas
2
2.3k
Technical Leadership for Architectural Decision Making
baasie
3
450
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!