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
AR_migrationの例外.pdf
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Hiroto Fukui
September 07, 2018
73
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AR_migrationの例外.pdf
Hiroto Fukui
September 07, 2018
More Decks by Hiroto Fukui
See All by Hiroto Fukui
Deploy from slack
bary822
0
82
メールアドレスを深堀りする
bary822
2
1.2k
kiba ETLで小さく始めるデータ分析基盤構築
bary822
3
290
GraphQLを_Rubyで気軽に試す.pdf
bary822
0
340
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
910
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.6k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
470
Darren the Foodie - Storyboard
khoart
PRO
3
3.5k
Odyssey Design
rkendrick25
PRO
2
730
Heart Work Chapter 1 - Part 1
lfama
PRO
8
36k
Accessibility Awareness
sabderemane
1
160
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
620
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.1k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
57k
Transcript
AR migrationの例外 @bary822
どんなの?
PendingMigrationError IrreversibleMigration UnknownMigrationVersionError
まだまだある
IllegalMigrationNameError - unless /^[_a-z0-9]+$/.match?(file_name) の時に発生 # A migration file name
can only contain underscores (_), lowercase characters, and numbers 0-9. Any other file name will raise an IllegalMigrationNameError.
DuplicateMigrationNameError - 同じ名前のmigrationが2つ以上存在した時にraiseされる version, = migrations.group_by(&:name).find { |_, v| v.length
> 1 } raise DuplicateMigrationVersionError.new(version) if version
ConcurrentMigrationError - 他のmigrationが実行中で、DBのlockがとれなかった時に発生 - 実行中のmigrationでdead lockが発生した時もそのケース
ここからチョット毛色が違う
ProtectedEnvironmentError - protected environment(デフォルトではproduction)に対してdb:drop, db:purge などのリスクが高い操作を行おうとすると発生 - DBの環境情報はinternal_metadata tableに入っている mysql>
SELECT * FROM ar_internal_metadata; +-------------+-------------+---------------------+---------------------+ | key | value | created_at | updated_at | +-------------+-------------+---------------------+---------------------+ | environment | development | 2018-08-23 03:01:21 | 2018-08-23 03:01:21 | +-------------+-------------+---------------------+---------------------+ 1 row in set (0.00 sec)
ProtectedEnvironmentError 導入の背景 https://github.com/rails/rails/pull/22967
おまけ - DuplicateMigrationNameErrorをhookしてrename