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
Hiroto Fukui
September 07, 2018
72
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
81
メールアドレスを深堀りする
bary822
2
1.2k
kiba ETLで小さく始めるデータ分析基盤構築
bary822
3
290
GraphQLを_Rubyで気軽に試す.pdf
bary822
0
340
Featured
See All Featured
Balancing Empowerment & Direction
lara
6
1.2k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
200
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
380
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
960
A Soul's Torment
seathinner
6
3k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
320
Designing Powerful Visuals for Engaging Learning
tmiket
1
430
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
We Are The Robots
honzajavorek
0
260
Un-Boring Meetings
codingconduct
0
330
Color Theory Basics | Prateek | Gurzu
gurzu
0
380
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