Skip to content

Commit

Permalink
update enju_leaf:backfill_migration_versions task
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeta committed Sep 23, 2024
1 parent 7f81dca commit 8e0c671
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions lib/tasks/enju_leaf_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,39 @@ namespace :enju_leaf do

desc 'Backfill migration versions before Next-L Enju Leaf 1.4'
task :backfill_migration_versions => :environment do
Rake::Task['db:migrate'].invoke
Rake::Task['enju_leaf:upgrade'].invoke
Rake::Task['enju_leaf:upgrade'].reenable

Dir.glob(Rails.root.join('db/migrate/*.rb')).each do |file|
entry = File.basename(file).split('_', 3)
entry = File.basename(file).split('_', 3)
table_name = entry[2].gsub(/\.rb\z/, '')
version = entry[0].to_i

# このバージョンより新しいマイグレーションファイルは対象外
next if version > 20201025090703
next if version >= 20201025090703

# enju_bookmark
next if [
55, 20081212151614, 20081212151820, 20100222124420, 20140524135607,
20140812093836, 20160815045420, 20180107172413,
20180709023035, 20180709023036, 20180709023037, 20180709023038,
20180709023039, 20180709023040, 20180709161346
].include?(version)

# enju_news
next if [
20081031033632, 20090126071155, 20110220103937
].include?(version)

# enju_biblio
next if [
20170116150432
].include?(version)

# enju_ndl
next if [
20171126072934, 20190501043418
].include?(version)

# enju_nii
next if [
Expand Down

0 comments on commit 8e0c671

Please sign in to comment.