diff --git a/backend/lib/tasks/import.rake b/backend/lib/tasks/import.rake index 8a05b4698ea..4c8b0110a0a 100644 --- a/backend/lib/tasks/import.rake +++ b/backend/lib/tasks/import.rake @@ -9,19 +9,21 @@ require_relative '../importer' namespace :gh do task :set_tiflash_replica => :environment do - ActiveRecord::Base.connection.execute("ALTER TABLE github_events SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE db_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE collections SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE collection_items SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE web_framework_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE nocode_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE static_site_generator_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE web_framework_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE cn_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE cn_orgs SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE js_framework_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE css_framework_repos SET TIFLASH REPLICA 1") - ActiveRecord::Base.connection.execute("ALTER TABLE users SET TIFLASH REPLICA 1") + if ENV["SKIP_REPLICA"].blank? + ActiveRecord::Base.connection.execute("ALTER TABLE github_events SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE db_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE collections SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE collection_items SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE web_framework_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE nocode_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE static_site_generator_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE web_framework_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE cn_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE cn_orgs SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE js_framework_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE css_framework_repos SET TIFLASH REPLICA 1") + ActiveRecord::Base.connection.execute("ALTER TABLE users SET TIFLASH REPLICA 1") + end end task :load_sample => :environment do