Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
140
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
130
Design a REST API you will love to work with
ujovlado
0
770
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
500
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
390
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
150
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
100
CSS Flexbox (WebElement #35)
ujovlado
0
170
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
180
Don't underestimate CSS (WebElement #30)
ujovlado
0
600
Other Decks in Programming
See All in Programming
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
340
React Native New Architecture 移行実践報告
taminif
1
130
CSC509 Lecture 14
javiergs
PRO
0
220
TUIライブラリつくってみた / i-just-make-TUI-library
kazto
1
310
WebRTC と Rust と8K 60fps
tnoho
2
1.9k
sbt 2
xuwei_k
0
190
20 years of Symfony, what's next?
fabpot
2
310
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.3k
CSC305 Lecture 17
javiergs
PRO
0
270
Reactive Thinking with Signals and the new Resource API
manfredsteyer
PRO
0
160
[堅牢.py #1] テストを書かない研究者に送る、最初にテストを書く実験コード入門 / Let's start your ML project by writing tests
shunk031
11
6.9k
AIコーディングエージェント(NotebookLM)
kondai24
0
130
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
4 Signs Your Business is Dying
shpigford
186
22k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Art, The Web, and Tiny UX
lynnandtonic
303
21k
Context Engineering - Making Every Token Count
addyosmani
9
470
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.2k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
36
6.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
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!