Skip to content

Commit 1b67822

Browse files
authored
Merge pull request rails#50170 from y-yagi/fix-db_system_change-to-trilogy
Don't add `default-mysql-client` when running `db:system:change` to Trilogy
2 parents f4b0845 + 1e3e013 commit 1b67822

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

railties/lib/rails/generators/database.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def gem_for_database(database = options[:database])
3030
def docker_for_database_build(database = options[:database])
3131
case database
3232
when "mysql" then "build-essential default-libmysqlclient-dev git"
33-
when "trilogy" then "build-essential default-libmysqlclient-dev git"
33+
when "trilogy" then "build-essential git"
3434
when "postgresql" then "build-essential git libpq-dev"
3535
when "sqlite3" then "build-essential git"
3636
else nil
@@ -40,7 +40,7 @@ def docker_for_database_build(database = options[:database])
4040
def docker_for_database_deploy(database = options[:database])
4141
case database
4242
when "mysql" then "curl default-mysql-client libvips"
43-
when "trilogy" then "curl default-mysql-client libvips"
43+
when "trilogy" then "curl libvips"
4444
when "postgresql" then "curl libvips postgresql-client"
4545
when "sqlite3" then "curl libsqlite3-0 libvips"
4646
else nil

railties/test/generators/db_system_change_generator_test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ class ChangeGeneratorTest < Rails::Generators::TestCase
9090
end
9191
end
9292

93+
test "change to trilogy" do
94+
run_generator ["--to", "trilogy"]
95+
96+
assert_file("config/database.yml") do |content|
97+
assert_match "adapter: trilogy", content
98+
assert_match "database: tmp_production", content
99+
end
100+
101+
assert_file("Gemfile") do |content|
102+
assert_match "# Use trilogy as the database for Active Record", content
103+
assert_match 'gem "trilogy", "~> 2.4"', content
104+
end
105+
106+
assert_file("Dockerfile") do |content|
107+
assert_match "build-essential git", content
108+
assert_match "curl libvips", content
109+
assert_no_match "default-libmysqlclient-dev", content
110+
end
111+
end
112+
93113
test "change from versioned gem to other versioned gem" do
94114
run_generator ["--to", "sqlite3"]
95115
run_generator ["--to", "mysql", "--force"]

0 commit comments

Comments
 (0)