Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Database Migrations in PHP (Posobota #66)
Search
Vladimír Kriška
October 25, 2014
Programming
180
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
200
Design a REST API you will love to work with
ujovlado
0
820
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
540
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
450
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
200
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
160
CSS Flexbox (WebElement #35)
ujovlado
0
220
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
220
Don't underestimate CSS (WebElement #30)
ujovlado
0
660
Other Decks in Programming
See All in Programming
Crash Auto Pipelines
veronikapj
1
320
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
150
Modernizing iOS Apps
seyfoyun
0
150
AI Augmentation Techniques with Liberty
ivargrimstad
0
270
Lambda durable functionsでHuman in the Loopを楽に…楽に……
har1101
2
250
AI時代のTerminal環境を UNIX哲学で設計・運用する
yasunori0418
1
330
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
210
オーケストレーション記述言語 Katari
yukikurage
0
220
AI駆動開発4年目の現在地(『あなたはFDEになるべきか?』イベント資料)
kumaiu
0
120
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
1.2k
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.3k
ActionController meets Protocol Buffers
sorah
1
770
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Become a Pro
speakerdeck
PRO
31
6.3k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Cult of Friendly URLs
andyhume
79
7.1k
Product Roadmaps are Hard
iamctodd
55
13k
Utilizing Notion as your number one productivity tool
mfonobong
4
630
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
550
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
A Tale of Four Properties
chriscoyier
163
24k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
390
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!