Skip to content

Commit 8f45ef8

Browse files
Do not set up cable DB if skipping action cable (rails#52923)
When creating a new rails app with the `--skip-action-cable` option, the generated `database.yml` should not set up the `cable` database.
1 parent 435a693 commit 8f45ef8

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

railties/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ production:
7373
<<: *primary_production
7474
database: <%= app_name %>_production_queue
7575
migrations_paths: db/queue_migrate
76+
<%- unless options.skip_action_cable? -%>
7677
cable:
7778
<<: *primary_production
7879
database: <%= app_name %>_production_cable
7980
migrations_paths: db/cable_migrate
81+
<%- end -%>
8082
<%- end -%>

railties/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ production:
105105
<<: *primary_production
106106
database: <%= app_name %>_production_queue
107107
migrations_paths: db/queue_migrate
108+
<%- unless options.skip_action_cable? -%>
108109
cable:
109110
<<: *primary_production
110111
database: <%= app_name %>_production_cable
111112
migrations_paths: db/cable_migrate
113+
<%- end -%>
112114
<%- end -%>

railties/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ production:
6262
<<: *default
6363
database: storage/production_queue.sqlite3
6464
migrations_paths: db/queue_migrate
65+
<%- unless options.skip_action_cable? -%>
6566
cable:
6667
<<: *default
6768
database: storage/production_cable.sqlite3
6869
migrations_paths: db/cable_migrate
70+
<%- end -%>
6971
<%- end -%>
7072
<%- end -%>

railties/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ production:
7373
<<: *primary_production
7474
database: <%= app_name %>_production_queue
7575
migrations_paths: db/queue_migrate
76+
<%- unless options.skip_action_cable? -%>
7677
cable:
7778
<<: *primary_production
7879
database: <%= app_name %>_production_cable
7980
migrations_paths: db/cable_migrate
81+
<%- end -%>
8082
<%- end -%>

railties/test/generators/app_generator_test.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ def test_app_update_does_not_generate_action_cable_contents_when_skip_action_cab
237237
assert_file "config/environments/production.rb" do |content|
238238
assert_no_match(/config\.action_cable/, content)
239239
end
240+
assert_file "config/database.yml" do |content|
241+
assert_no_match(/cable:/, content)
242+
end
240243
end
241244

242245
def test_app_update_does_not_generate_bootsnap_contents_when_skip_bootsnap_is_given

0 commit comments

Comments
 (0)