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
Writing Readable Migrations with Nextras Migrat...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Jan Tvrdík
October 12, 2017
Programming
120
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Writing Readable Migrations with Nextras Migrations
Jan Tvrdík
October 12, 2017
More Decks by Jan Tvrdík
See All by Jan Tvrdík
Runtime Types in TypeScript
jantvrdik
0
69
How to Write Parser in PHP
jantvrdik
0
110
Nextras Mail Panel
jantvrdik
0
180
Writing reliable migrations with Nextras Migrations
jantvrdik
1
710
Other Decks in Programming
See All in Programming
速習iPhone Duo対応
yuukiw00w
1
710
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
4.9k
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
320
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
5
4.3k
一人だけ、Kiroが静止する日
hideg
0
130
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
250
AgentCore CLI で進化した AWS での AI エージェントの作り方 : 必要な機能を必要な時に
icoxfog417
PRO
3
370
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
2.8k
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
1.8k
What We Talk About When We Talk About XP
m_seki
2
670
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.3k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
120
Featured
See All Featured
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
440
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
3k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
57k
From π to Pie charts
rasagy
1
380
WCS-LA-2024
lcolladotor
0
830
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
520
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Transcript
Jan Tvrdík
None
but not limited to database snapshot approach mostly not usable
delta approach is hard to get right
None
None
None
None
None
Business Critical Code
doctrine:migrations:diff \ --formatted
None
None
queries wrapped in strings strings wrapped in method calls method
calls wrapped in a method body method body wrapped in a class
let's give each migration a descriptive name let's make the
content match the name let's remove all the noise by using SQL
None
None
easy to write code completion works well easy to format
„Reformat Code“ just works easy to read no noise & well formatted easy to test „Run“ just works „Copy & Paste“ just works no limitations
migrations/ ├── 001.sql ├── 002.sql └── ... +---------+----------+---------------------+----+ | file
| checksum | executed | ok | +---------+----------+---------------------+----+ | 001.sql | 78634... | 2015-08-28 17:05:03 | 1 | | 002.sql | dda40... | 2015-08-28 17:05:03 | 1 | | 003.sql | 5b9c6... | 2015-08-28 17:05:03 | 1 | +---------+----------+---------------------+----+
order is strictly defined new migrations can be only at
the end you must always „rebase“ your migrations once executed migration cannot be changed
migrations/ ├── structures/ │ ├── 2015-07-21-170126-init.sql │ └── 2015-07-22-144133-photo-description.sql ├──
basic-data/ │ └── ... └── dummy-data/ └── ...
S B P D L Structures Basic data Dummy data
Production Localhost
structures DDL only + DML required for DDL basic data
DML for tables in 2 (countries, languages…) dummy data for testing app on localhost w/o strict rules because not used on production
Symfony commands migrations:continue migrations:reset migrations:create
simple web interface when CLI is not available
PHP 5.4+ databases PostgreSQL MySQL DBALs Nextras DBAL Nette Database
Doctrine DBAL dibi
SQL executes all queries in *.sql file PHP for complex
migrations
extensions: migrations: Nextras\Migrations\Bridges\NetteDI\MigrationsExtension migrations: dir: %appDir%/../migrations # base directory driver:
pgsql # pgsql or mysql dbal: doctrine # nextras, nette, doctrine or dibi diffGenerator: doctrine ignoredQueriesFile: "%appDir%/../migrations/ignored.sql"
new \Nextras\Migrations\Bridges\SymfonyBundle\NextrasMigrationsBundle(); nextras_migrations: dir: "%kernel.root_dir%/migrations" driver: pgsql # pgsql or
mysql dbal: nextras # nextras, nette, doctrine or dibi diff_generator: doctrine ignored_queries_file: "%kernel.root_dir%/migrations/ignored.sql"
https://github.com/nextras/migrations https://nextras.org/migrations/docs/
Twitter + GitHub @JanTvrdik nextras.org