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
750
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
480
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
370
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
140
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
89
CSS Flexbox (WebElement #35)
ujovlado
0
160
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
160
Don't underestimate CSS (WebElement #30)
ujovlado
0
590
Other Decks in Programming
See All in Programming
なぜ今、Terraformの本を書いたのか? - 著者陣に聞く!『Terraformではじめる実践IaC』登壇資料
fufuhu
4
660
TROCCO×dbtで実現する人にもAIにもやさしいデータ基盤
nealle
0
330
MLH State of the League: 2026 Season
theycallmeswift
0
160
CSC305 Summer Lecture 06
javiergs
PRO
0
100
兎に角、コードレビュー
mitohato14
0
150
学習を成果に繋げるための個人開発の考え方 〜 「学習のための個人開発」のすすめ / personal project for leaning
panda_program
1
110
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
150
管你要 trace 什麼、bpftrace 用下去就對了 — COSCUP 2025
shunghsiyu
0
470
「リーダーは意思決定する人」って本当?~ 学びを現場で活かす、リーダー4ヶ月目の試行錯誤 ~
marina1017
0
240
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
730
AIエージェント開発、DevOps and LLMOps
ymd65536
1
350
令和最新版手のひらコンピュータ
koba789
14
8k
Featured
See All Featured
Speed Design
sergeychernyshev
32
1.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.6k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
358
30k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
185
54k
Java REST API Framework Comparison - PWX 2021
mraible
33
8.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Balancing Empowerment & Direction
lara
2
590
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
120k
A Modern Web Designer's Workflow
chriscoyier
695
190k
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!