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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
520
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
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
170
フィードバックで育てるAI開発
kotaminato
1
100
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
130
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
210
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
210
分散システム、なんですぐ死んでしまうん?耐障害性を高めたいあなたのためのレジリエンスパターン入門
mshibuya
7
3.8k
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
210
過去最大のMCPアップデート! 2026-07-28 RC版の謎に迫る
licux
6
450
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
340
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
360
自作OSでスライド発表する
uyuki234
1
3.6k
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
1k
Featured
See All Featured
The Curse of the Amulet
leimatthew05
2
13k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
New Earth Scene 8
popppiees
3
2.4k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
460
Agile that works and the tools we love
rasmusluckow
331
22k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
340
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
WCS-LA-2024
lcolladotor
0
670
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
330
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
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!