From dbee80bca0ef504120219e6c7686437456511060 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Fri, 1 Dec 2017 18:16:06 +0900 Subject: Make `Migrator.current_version` work without a current database This is necessary in order to make the processing dependent on `Migrator.current_version` work even without database. Context: https://github.com/rails/rails/pull/31135#issuecomment-348404326 --- railties/test/application/rake/dbs_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'railties/test/application/rake/dbs_test.rb') diff --git a/railties/test/application/rake/dbs_test.rb b/railties/test/application/rake/dbs_test.rb index 0235210fdd..2082e9fa9f 100644 --- a/railties/test/application/rake/dbs_test.rb +++ b/railties/test/application/rake/dbs_test.rb @@ -98,6 +98,20 @@ module ApplicationTests end end + test "db:create works when schema cache exists and database does not exist" do + use_postgresql + + begin + rails %w(db:create db:migrate db:schema:cache:dump) + + rails "db:drop" + rails "db:create" + assert_equal 0, $?.exitstatus + ensure + rails "db:drop" rescue nil + end + end + test "db:drop failure because database does not exist" do output = rails("db:drop:_unsafe", "--trace") assert_match(/does not exist/, output) -- cgit v1.2.3