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
110
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
92
Design a REST API you will love to work with
ujovlado
0
730
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
460
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
350
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
110
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
69
CSS Flexbox (WebElement #35)
ujovlado
0
140
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
150
Don't underestimate CSS (WebElement #30)
ujovlado
0
560
Other Decks in Programming
See All in Programming
ウォンテッドリーの「ココロオドル」モバイル開発 / Wantedly's "kokoro odoru" mobile development
kubode
1
170
個人開発の学生アプリが企業譲渡されるまで
akidon0000
0
930
AIコーディングの理想と現実
tomohisa
29
34k
Bedrock×MCPで社内ブログ執筆文化を育てたい!
har1101
6
1.1k
設計の本質:コード、システム、そして組織へ / The Essence of Design: To Code, Systems, and Organizations
nrslib
5
1.2k
The Nature of Complexity in John Ousterhout’s Philosophy of Software Design
philipschwarz
PRO
0
130
The Implementations of Advanced LR Parser Algorithm
junk0612
1
390
七輪ライブラリー: Claude AI で作る Next.js アプリ
suneo3476
1
120
新しいPHP拡張モジュールインストール方法「PHP Installer for Extensions (PIE)」を使ってみよう!
cocoeyes02
0
410
note の Elasticsearch 更新系を支える技術
tchov
0
140
KawaiiLT 登壇資料 キャリアとモチベーション
hiiragi
0
140
REALITY コマンド作成チュートリアル
nishiuriraku
0
110
Featured
See All Featured
[RailsConf 2023] Rails as a piece of cake
palkan
54
5.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
35
2.6k
Building an army of robots
kneath
304
45k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
47
2.7k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.3k
Faster Mobile Websites
deanohume
306
31k
Adopting Sorbet at Scale
ufuk
76
9.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
31
1.1k
Raft: Consensus for Rubyists
vanstee
137
6.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.4k
Typedesign – Prime Four
hannesfritz
41
2.6k
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!