diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index cdc6987b0155f..f22daff2a8034 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Fix running `db:system:change` when app has no Dockerfile. + + *Hartley McGuire* + * In Action Mailer previews, list inline attachments separately from normal attachments. For example, attachments that were previously listed like diff --git a/railties/lib/rails/generators/rails/db/system/change/change_generator.rb b/railties/lib/rails/generators/rails/db/system/change/change_generator.rb index 0f59d1dcc1ec8..5bfb56bef15c7 100644 --- a/railties/lib/rails/generators/rails/db/system/change/change_generator.rb +++ b/railties/lib/rails/generators/rails/db/system/change/change_generator.rb @@ -41,6 +41,9 @@ def edit_gemfile end def edit_dockerfile + dockerfile_path = File.expand_path("Dockerfile", destination_root) + return unless File.exist?(dockerfile_path) + build_name = docker_for_database_build deploy_name = docker_for_database_deploy if build_name diff --git a/railties/test/commands/db_system_change_test.rb b/railties/test/commands/db_system_change_test.rb index 55caddb85b23c..2c7d896713e11 100644 --- a/railties/test/commands/db_system_change_test.rb +++ b/railties/test/commands/db_system_change_test.rb @@ -60,6 +60,14 @@ class Rails::Command::DbSystemChangeTest < ActiveSupport::TestCase assert_match "gsub Gemfile", output end + test "change works with no Dockerfile" do + remove_file("Dockerfile") + + output = change_database(to: "sqlite3") + + assert_match "gsub Gemfile", output + end + private def change_database(to:, **options) args = ["--to", to]