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
75
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
350
Featured
See All Featured
Speed Design
sergeychernyshev
33
2k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
440
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
The SEO Collaboration Effect
kristinabergwall1
1
510
Mind Mapping
helmedeiros
PRO
1
300
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
530
Abbi's Birthday
coloredviolet
3
9.1k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
560
Reality Check: Gamification 10 Years Later
codingconduct
0
2.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