Module: DummyApp::Migrations

Extended by:
Migrations
Included in:
Migrations
Defined in:
lib/spree/testing_support/dummy_app/migrations.rb

Instance Method Summary collapse

Instance Method Details

#auto_migrateObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/spree/testing_support/dummy_app/migrations.rb', line 7

def auto_migrate
  if needs_migration?
    puts "Configuration changed. Re-running migrations"

    # Disconnect to avoid "database is being accessed by other users" on postgres
    ActiveRecord::Base.remove_connection

    sh 'rake db:reset VERBOSE=false'

    # We have a brand new database, so we must re-establish our connection
    ActiveRecord::Base.establish_connection
  end
end