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
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
500
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.2k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.3k
sira's awesome portfolio website redesign presentation
elsirapls
0
290
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
250
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
A Soul's Torment
seathinner
6
3k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
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