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
150
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
150
Design a REST API you will love to work with
ujovlado
0
780
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
510
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
400
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
160
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
120
CSS Flexbox (WebElement #35)
ujovlado
0
180
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
190
Don't underestimate CSS (WebElement #30)
ujovlado
0
620
Other Decks in Programming
See All in Programming
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.6k
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
Grafana:建立系統全知視角的捷徑
blueswen
0
330
MUSUBIXとは
nahisaho
0
140
Package Management Learnings from Homebrew
mikemcquaid
0
230
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
220
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
170
Featured
See All Featured
Music & Morning Musume
bryan
47
7.1k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
100
Discover your Explorer Soul
emna__ayadi
2
1.1k
Mind Mapping
helmedeiros
PRO
0
88
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
420
HDC tutorial
michielstock
1
390
Game over? The fight for quality and originality in the time of robots
wayneb77
1
120
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
440
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
910
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
A Tale of Four Properties
chriscoyier
162
24k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
94
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!