Skip to content

Commit

Permalink
Fixed charset check for MariaDB 11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Jun 17, 2024
1 parent 5523449 commit 236c451
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 2.0.0 (unreleased)
## 1.9.0 (unreleased)

- Fixed charset check for MariaDB 11.4
- Dropped support for Ruby < 3 and Active Record < 6.1

## 1.8.0 (2024-03-11)
Expand Down
7 changes: 4 additions & 3 deletions lib/strong_migrations/adapters/mysql_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def change_type_safe?(table, column, type, options, existing_column, existing_ty
sql = <<~SQL
SELECT cs.MAXLEN
FROM INFORMATION_SCHEMA.CHARACTER_SETS cs
INNER JOIN INFORMATION_SCHEMA.COLLATIONS c ON c.CHARACTER_SET_NAME = cs.CHARACTER_SET_NAME
INNER JOIN INFORMATION_SCHEMA.TABLES t ON t.TABLE_COLLATION = c.COLLATION_NAME
WHERE t.TABLE_SCHEMA = database() AND t.TABLE_NAME = #{connection.quote(table)}
INNER JOIN INFORMATION_SCHEMA.COLUMNS c ON c.CHARACTER_SET_NAME = cs.CHARACTER_SET_NAME
WHERE c.TABLE_SCHEMA = database() AND
c.TABLE_NAME = #{connection.quote(table)} AND
c.COLUMN_NAME = #{connection.quote(column)}
SQL
row = connection.select_all(sql).first
if row
Expand Down

0 comments on commit 236c451

Please sign in to comment.