From 8e0c671a2b90ed8b22d51ac8ab5b399f6fbaf050 Mon Sep 17 00:00:00 2001 From: Kosuke Tanabe Date: Mon, 23 Sep 2024 15:58:02 +0900 Subject: [PATCH] update enju_leaf:backfill_migration_versions task --- lib/tasks/enju_leaf_tasks.rake | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/tasks/enju_leaf_tasks.rake b/lib/tasks/enju_leaf_tasks.rake index c71fdae21..56fee65df 100644 --- a/lib/tasks/enju_leaf_tasks.rake +++ b/lib/tasks/enju_leaf_tasks.rake @@ -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 [