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
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
190
Design a REST API you will love to work with
ujovlado
0
810
Docker for PHP developers - Tips, Tricks & Lessons learned
ujovlado
3
530
Docker ‐ from development to production in minutes (PoSobota #91)
ujovlado
0
440
Non-traditional use of Docker (Nette Camp #3)
ujovlado
0
200
Contributions [lightning talk] (PyconCZ 2015)
ujovlado
0
150
CSS Flexbox (WebElement #35)
ujovlado
0
210
Simplify your dev life with Docker (WebElement Banská Bystrica)
ujovlado
0
210
Don't underestimate CSS (WebElement #30)
ujovlado
0
650
Other Decks in Programming
See All in Programming
XHTMLが残したもの
yosuke_furukawa
PRO
2
470
フロントエンドUIフレームワークのこれまでとこれから
ssssota
1
1.1k
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
4
2.1k
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
100
AIとGame Jamで、ゲームを完成させた話
takahirosaeki
0
110
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
110
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
260
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
DynamoDBの基礎を振り返りながらベクトル検索機能を理解する
musan
3
270
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
510
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
100
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
840
YesSQL, Process and Tooling at Scale
rocio
174
15k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.2k
Un-Boring Meetings
codingconduct
0
410
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Embracing the Ebb and Flow
colly
88
5.2k
Technical Leadership for Architectural Decision Making
baasie
3
560
Discover your Explorer Soul
emna__ayadi
2
1.3k
The browser strikes back
jonoalderson
0
1.6k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Building Applications with DynamoDB
mza
96
7.2k
How GitHub (no longer) Works
holman
316
150k
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!