Skip to content

Instantly share code, notes, and snippets.

@bogdan
Created April 30, 2018 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bogdan/0693af787f1eb3b5378ce95273e83165 to your computer and use it in GitHub Desktop.
Save bogdan/0693af787f1eb3b5378ce95273e83165 to your computer and use it in GitHub Desktop.
require Rails.root.join 'support/2018/20180202160337_db_extraction'
class DevShard1Extraction < ActiveRecord::Migration[5.1]
extractor = DbExtraction.new
if extractor.db_match?
raise 'Please set the shard 1 DB to be different from primary DB. You may take the config/deploy/templates/database.yml or modify your own copy.'
end
shard 1
def change
return unless Rails.env.development?
DbExtraction.new.perform
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment