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
AR_migrationの例外.pdf
Search
Hiroto Fukui
September 07, 2018
92
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
AR_migrationの例外.pdf
Hiroto Fukui
September 07, 2018
Transcript
11 slides
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
More Decks by Hiroto Fukui
See All by Hiroto Fukui
Deploy from slack
bary822
0
94
メールアドレスを深堀りする
bary822
2
1.2k
kiba ETLで小さく始めるデータ分析基盤構築
bary822
3
300
GraphQLを_Rubyで気軽に試す.pdf
bary822
0
380
Featured
See All Featured
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
610
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
310
AI: The stuff that nobody shows you
jnunemaker
PRO
12
1.3k
Visualization
eitanlees
153
17k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
The Art of Programming - Codeland 2020
erikaheidi
57
15k
Producing Creativity
orderedlist
PRO
348
41k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
sira's awesome portfolio website redesign presentation
elsirapls
0
530
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
1.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k