diff options
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 9a5c5ed223..b2c52a092f 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -134,6 +134,18 @@ module ApplicationTests db_structure_dump_and_load database_url_db_name end + test 'db:structure:dump does not dump schema information when no migrations are used' do + Dir.chdir(app_path) do + # create table without migrations + `bundle exec rails runner 'ActiveRecord::Base.connection.create_table(:posts) {|t| t.string :title }'` + + stderr_output = capture(:stderr) { `bundle exec rake db:structure:dump` } + assert_empty stderr_output + structure_dump = File.read("db/structure.sql") + assert_match(/CREATE TABLE \"posts\"/, structure_dump) + end + end + def db_test_load_structure Dir.chdir(app_path) do `rails generate model book title:string; |