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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Vladimír Kriška
October 25, 2014
Programming
0
150
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
160
Design a REST API you will love to work with
ujovlado
0
790
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
510
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
400
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
170
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
120
CSS Flexbox (WebElement #35)
ujovlado
0
190
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
190
Don't underestimate CSS (WebElement #30)
ujovlado
0
620
Other Decks in Programming
See All in Programming
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.3k
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
500
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
new(1.26) ← これすき / kamakura.go #8
utgwkk
0
2.5k
Claude Code Skill入門
mayahoney
0
410
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
410
Windows on Ryzen and I
seosoft
0
330
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
140
Claude Codeログ基盤の構築
giginet
PRO
7
3.5k
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
230
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
250
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.9k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
460
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
87
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
290
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
780
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
260
Navigating Weather and Climate Data
rabernat
0
140
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.1k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
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!