$30 off During Our Annual Pro Sale. View Details »
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
140
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
110
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
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
150
AIエージェントの設計で注意するべきポイント6選
har1101
5
1.6k
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
450
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
390
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
4
900
Microservices rules: What good looks like
cer
PRO
0
1.6k
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.6k
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.4k
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
0
100
dotfiles 式年遷宮 令和最新版
masawada
1
800
tparseでgo testの出力を見やすくする
utgwkk
2
260
UIデザインに役立つ 2025年の最新CSS / The Latest CSS for UI Design 2025
clockmaker
18
7.6k
Featured
See All Featured
GitHub's CSS Performance
jonrohan
1032
470k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
87
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
47
33k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
200
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
72
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
12
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
63
Why Our Code Smells
bkeepers
PRO
340
57k
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!