Skip to content

Commit

Permalink
Regression test for rails#23307
Browse files Browse the repository at this point in the history
This exercises `assume_migrated_upto_version` in `activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb`

`db:drop db:create db:schema:load` and triggers the error mentioned in rails#23307
  • Loading branch information
britg committed Jan 28, 2016
1 parent 2637fb7 commit 0eadab2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions railties/test/application/rake/dbs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,26 @@ def db_test_load_structure
ActiveRecord::Base.connection_config[:database]
end
end

test "db:schema:load after db:drop db:create" do
Dir.chdir(app_path) do
app_file 'db/migrate/1_migration.rb', <<-RUBY
# dummy file
RUBY
app_file 'db/schema.rb', <<-RUBY
ActiveRecord::Schema.define(version: 20140423102712) do
create_table("comments") do |t|
t.string :name
end
end
RUBY

`bin/rails db:drop db:create db:schema:load`

tables = `bin/rails runner 'p ActiveRecord::Base.connection.tables'`.strip
assert_match(/"comments"/, tables)
end
end

test 'db:test:load_structure without database_url' do
require "#{app_path}/config/environment"
Expand Down

0 comments on commit 0eadab2

Please sign in to comment.