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
98
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
74
Design a REST API you will love to work with
ujovlado
0
710
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
450
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
340
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
93
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
58
CSS Flexbox (WebElement #35)
ujovlado
0
120
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
130
Don't underestimate CSS (WebElement #30)
ujovlado
0
540
Other Decks in Programming
See All in Programming
Terraform で作る Amazon ECS の CI/CD パイプライン
hiyanger
0
110
Rubyでつくるパケットキャプチャツール
ydah
0
260
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
400
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
4
1.1k
HTML/CSS超絶浅い説明
yuki0329
0
200
Внедряем бюджетирование, или Как сделать хорошо?
lamodatech
0
970
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
130
Beyond ORM
77web
11
1.6k
ASP.NET Core の OpenAPIサポート
h455h1
0
150
テストコード書いてみませんか?
onopon
2
360
AWSマネコンに複数のアカウントで入れるようになりました
yuhta28
2
140
functionalなアプローチで動的要素を排除する
ryopeko
1
740
Featured
See All Featured
The Cost Of JavaScript in 2023
addyosmani
47
7.2k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.3k
Into the Great Unknown - MozCon
thekraken
34
1.6k
Learning to Love Humans: Emotional Interface Design
aarron
274
40k
How GitHub (no longer) Works
holman
312
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Raft: Consensus for Rubyists
vanstee
137
6.7k
The Invisible Side of Design
smashingmag
299
50k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
Writing Fast Ruby
sferik
628
61k
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!