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
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Database Migrations in PHP (Posobota #66)
Vladimír Kriška
October 25, 2014
More Decks by Vladimír Kriška
See All by Vladimír Kriška
Twelve-Factor app with Docker
ujovlado
0
180
Design a REST API you will love to work with
ujovlado
0
800
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
520
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
420
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
190
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
130
CSS Flexbox (WebElement #35)
ujovlado
0
200
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
200
Don't underestimate CSS (WebElement #30)
ujovlado
0
640
Other Decks in Programming
See All in Programming
AutonomyとControlのあいだ:Graflowで記述するAIエージェント協調
myui
0
120
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
190
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
330
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
540
Vite+ Unified Toolchain for the Web
naokihaba
0
290
Oxcを導入して開発体験が向上した話
yug1224
4
310
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
230
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
250
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
メソッドのジェネリクスでGoの夢は広がるか? / Kyoto.go #65
utgwkk
3
740
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
780
AIだと陥りがちなJakarta EE最新技術への移行時の落とし穴と解決策
tnagao7
0
110
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
Color Theory Basics | Prateek | Gurzu
gurzu
0
360
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Prompt Engineering for Job Search
mfonobong
0
340
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
Documentation Writing (for coders)
carmenintech
77
5.4k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Facilitating Awesome Meetings
lara
57
7k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Context Engineering - Making Every Token Count
addyosmani
9
960
Done Done
chrislema
186
16k
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!