From 29479553aa3c1331ee487e5b4d816cb033a6430b Mon Sep 17 00:00:00 2001 From: Ko Nagase Date: Thu, 12 Dec 2024 07:42:05 +0900 Subject: [PATCH 6/8] Support configurable skip tables --- lib/tasks/extract_fixtures.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/extract_fixtures.rake b/lib/tasks/extract_fixtures.rake index 12636ced0..f7e5ae280 100644 --- a/lib/tasks/extract_fixtures.rake +++ b/lib/tasks/extract_fixtures.rake @@ -37,13 +37,14 @@ end task :extract_fixtures => :environment do dir = ENV['DIR'] || './tmp/fixtures' time_offset = ENV['TIME_OFFSET'] || '' + skip_tables = ENV['SKIP_TABLES']&.split(',') || [] FileUtils.mkdir_p(dir) if time_offset.present? && !time_offset.match?(/^([+-](0[0-9]|1[0-4]):[0-5][0-9])$/) abort("Invalid TIME_OFFSET format. Use +HH:MM or -HH:MM (e.g. +09:00)") end + skip_tables += ["schema_migrations", "ar_internal_metadata"] - skip_tables = ["schema_migrations", "ar_internal_metadata"] ActiveRecord::Base.establish_connection (ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| i = "000" -- 2.47.1