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
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Tell your own story through comics
letsgokoyo
1
980
Agile that works and the tools we love
rasmusluckow
331
22k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
240
30 Presentation Tips
portentint
PRO
1
330
Between Models and Reality
mayunak
4
360
It's Worth the Effort
3n
188
29k
Odyssey Design
rkendrick25
PRO
2
710
Technical Leadership for Architectural Decision Making
baasie
3
420
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
370
Designing Powerful Visuals for Engaging Learning
tmiket
1
430
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