Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
CSC305 Lecture 17
javiergs
PRO
0
340
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
11
11k
Go コードベースの構成と AI コンテキスト定義
andpad
0
120
WebRTC と Rust と8K 60fps
tnoho
2
1.9k
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
2
650
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
120
Integrating WordPress and Symfony
alexandresalome
0
150
tparseでgo testの出力を見やすくする
utgwkk
1
190
FluorTracer / RayTracingCamp11
kugimasa
0
220
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
420
AIエンジニアリングのご紹介 / Introduction to AI Engineering
rkaga
5
2k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
430
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.4k
Faster Mobile Websites
deanohume
310
31k
[RailsConf 2023] Rails as a piece of cake
palkan
58
6.1k
GitHub's CSS Performance
jonrohan
1032
470k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Become a Pro
speakerdeck
PRO
31
5.7k
Building Flexible Design Systems
yeseniaperezcruz
330
39k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
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!