Skip to content

Commit

Permalink
feat(backend): support skip tiflash replica (#716)
Browse files Browse the repository at this point in the history
Update import.rake
  • Loading branch information
hooopo committed Aug 18, 2022
1 parent b314ffe commit 31271cb
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions backend/lib/tasks/import.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31271cb

Please # to comment.