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
130
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
120
Design a REST API you will love to work with
ujovlado
0
750
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
480
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
380
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
140
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
93
CSS Flexbox (WebElement #35)
ujovlado
0
160
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
170
Don't underestimate CSS (WebElement #30)
ujovlado
0
590
Other Decks in Programming
See All in Programming
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
為你自己學 Python - 冷知識篇
eddie
1
350
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
330
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
250
MCPとデザインシステムに立脚したデザインと実装の融合
yukukotani
4
1.4k
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
1.9k
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
楽して成果を出すためのセルフリソース管理
clipnote
0
180
アセットのコンパイルについて
ojun9
0
130
デザイナーが Androidエンジニアに 挑戦してみた
874wokiite
0
540
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
230
AIと私たちの学習の変化を考える - Claude Codeの学習モードを例に
azukiazusa1
10
4.4k
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Into the Great Unknown - MozCon
thekraken
40
2k
The Invisible Side of Design
smashingmag
301
51k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.5k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.6k
The Cost Of JavaScript in 2023
addyosmani
53
8.9k
Building an army of robots
kneath
306
46k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.9k
The Pragmatic Product Professional
lauravandoore
36
6.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
368
19k
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!