diff options
author | Yves Senn <yves.senn@gmail.com> | 2015-04-27 10:45:22 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2015-04-27 11:45:21 +0200 |
commit | 557c46a41ec73c485a783b56fbbe893a00f49fe8 (patch) | |
tree | f92d2890d718e3abd5ffdc49d391f901e4d10c7b /railties/test/application | |
parent | ba35b4702e012f866c4bf904d5b7da21375b3133 (diff) | |
download | rails-557c46a41ec73c485a783b56fbbe893a00f49fe8.tar.gz rails-557c46a41ec73c485a783b56fbbe893a00f49fe8.tar.bz2 rails-557c46a41ec73c485a783b56fbbe893a00f49fe8.zip |
Revert "Merge pull request #17920 from calebthompson/dont-rely-on-environment-task-for-schema-load"
This reverts commit 08ff4ccbbb3fb143a02e6752efb974a4bcfcd3bb, reversing
changes made to 6c9ed6dbc62450cdb87559afd15798305e069146.
Caused by #17920.
Closes #19545.
This patch introduced regressions because initializers were no longer
loaded. Specifically missing inflections result in broken restores of
the database.
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/rake/dbs_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index c414732f92..5cc9790b28 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -181,6 +181,34 @@ module ApplicationTests end end + test "db:schema:load with inflections" do + Dir.chdir(app_path) do + app_file 'config/initializers/inflection.rb', <<-RUBY + ActiveSupport::Inflector.inflections do |inflect| + inflect.irregular 'goose', 'geese' + end + RUBY + app_file 'config/initializers/primary_key_table_name.rb', <<-RUBY + ActiveRecord::Base.primary_key_prefix_type = :table_name + RUBY + app_file 'db/schema.rb', <<-RUBY + ActiveRecord::Schema.define(version: 20140423102712) do + create_table("goose".pluralize) do |t| + t.string :name + end + end + RUBY + + `bin/rake db:schema:load` + + tables = `bin/rails runner 'p ActiveRecord::Base.connection.tables'`.strip + assert_match(/"geese"/, tables) + + columns = `bin/rails runner 'p ActiveRecord::Base.connection.columns("geese").map(&:name)'`.strip + assert_equal columns, '["gooseid", "name"]' + end + end + def db_test_load_structure Dir.chdir(app_path) do `rails generate model book title:string; |