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
73
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
44
Design a REST API you will love to work with
ujovlado
0
630
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
380
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
270
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
67
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
41
CSS Flexbox (WebElement #35)
ujovlado
0
98
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
90
Don't underestimate CSS (WebElement #30)
ujovlado
0
510
Other Decks in Programming
See All in Programming
SIMD Parallel Programming with the Vector API
josepaumard
0
240
PHPはいつから死んでいるかの調査
chiroruxx
2
430
Ruby Pattern Matching
bkuhlmann
0
940
見た目から始める生産性向上
ikumatadokoro
10
1.5k
Micro Frontends for Java Microservices - Utah JUG 2024
mraible
PRO
1
110
2024 コーディング研修
ckazu
0
440
AWS CDKコントリビュートTIPS / aws-cdk-contribution-tips
gotok365
4
550
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
920
Ruby GitHub Packages
bkuhlmann
0
650
Fragment Composition of GraphQL
quramy
13
1.6k
Scalable Customer Journey Orchestration (CJO)
lewuathe
0
450
新宿ダンジョンを可視化してみた
satoshi7190
3
420
Featured
See All Featured
Designing for Performance
lara
601
67k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Large-scale JavaScript Application Architecture
addyosmani
504
110k
Raft: Consensus for Rubyists
vanstee
133
6.3k
Code Reviewing Like a Champion
maltzj
515
39k
Art, The Web, and Tiny UX
lynnandtonic
290
19k
Unsuck your backbone
ammeep
664
57k
Music & Morning Musume
bryan
41
5.6k
The Pragmatic Product Professional
lauravandoore
26
5.8k
Gamification - CAS2011
davidbonilla
77
4.6k
GraphQLの誤解/rethinking-graphql
sonatard
56
9.3k
Making the Leap to Tech Lead
cromwellryan
125
8.5k
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!