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
80
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
50
Design a REST API you will love to work with
ujovlado
0
660
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
400
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
290
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
71
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
42
CSS Flexbox (WebElement #35)
ujovlado
0
100
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
97
Don't underestimate CSS (WebElement #30)
ujovlado
0
520
Other Decks in Programming
See All in Programming
DynamoDB コスト最適化っぽいことの基本 with Terraform
kuro_kurorrr
2
250
はしめてのプログラミングとロボット制御
watawatavoltage
0
290
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
140
유연한 Composable 설계
l2hyunwoo
0
380
入社1ヶ月でここまでやった!Findy Toolsインフラ支援の最適化
rvirus0817
6
1.4k
さきがけから振り返るアーキテクチャ刷新 / Reflecting on the Architectural Renewal from the Vanguard
nrslib
2
770
Architectures with Lightweight Stores: New Rules and Options
manfredsteyer
PRO
0
100
スクラムマスターって孤独じゃないですか?
yoshitaroyoyo
1
140
Namespace on read
tagomoris
2
370
社内 LT 会を発足し、アウトプット文化を醸成させるために考えたこと・やったこと / Starting internal LT meetings and fostering an output culture
mackey0225
3
120
リハビリmruby
kishima
1
160
SRE チーム立ち上げ前に考えたこと・取り組んだこと / Considerations and Preparations Before Establishing an SRE Team
mackey0225
3
320
Featured
See All Featured
Embracing the Ebb and Flow
colly
81
4.3k
The Mythical Team-Month
searls
217
43k
Optimizing for Happiness
mojombo
373
69k
Teambox: Starting and Learning
jrom
130
8.6k
GraphQLとの向き合い方2022年版
quramy
36
13k
From Idea to $5000 a Month in 5 Months
shpigford
377
46k
Design by the Numbers
sachag
277
18k
Fireside Chat
paigeccino
25
2.8k
Why Our Code Smells
bkeepers
PRO
332
56k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
662
120k
Imperfection Machines: The Place of Print at Facebook
scottboms
262
13k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
502
140k
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!