From c2a3ab34e99a6ec80956d0823d7b8d2e0aff0a4d Mon Sep 17 00:00:00 2001 From: OuYangJinTing Date: Mon, 6 Jan 2025 12:36:04 +0800 Subject: [PATCH] Fix DATABASE_URL variable in the ci template [skip ci] The DATABASE_URL variable should follow the database option --- .../rails/generators/rails/app/templates/github/ci.yml.tt | 4 +++- .../rails/generators/rails/plugin/templates/github/ci.yml.tt | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt b/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt index 8f1f78a6b123c..b44873c3c6627 100644 --- a/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt +++ b/railties/lib/rails/generators/rails/app/templates/github/ci.yml.tt @@ -120,8 +120,10 @@ jobs: - name: Run tests env: RAILS_ENV: test - <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%> + <%- if options[:database] == "mysql" -%> DATABASE_URL: mysql2://127.0.0.1:3306 + <%- elsif options[:database] == "trilogy" -%> + DATABASE_URL: trilogy://127.0.0.1:3306 <%- elsif options[:database] == "postgresql" -%> DATABASE_URL: postgres://postgres:postgres@localhost:5432 <%- end -%> diff --git a/railties/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt b/railties/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt index a2e2b6f9f7d83..186720c5157a0 100644 --- a/railties/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +++ b/railties/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt @@ -84,8 +84,10 @@ jobs: - name: Run tests env: RAILS_ENV: test - <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%> + <%- if options[:database] == "mysql" -%> DATABASE_URL: mysql2://127.0.0.1:3306 + <%- elsif options[:database] == "trilogy" -%> + DATABASE_URL: trilogy://127.0.0.1:3306 <%- elsif options[:database] == "postgresql" -%> DATABASE_URL: postgres://postgres:postgres@localhost:5432 <%- end -%> @@ -100,4 +102,3 @@ jobs: path: ${{ github.workspace }}/tmp/screenshots if-no-files-found: ignore <% end -%> -