mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix CI failures due to MySQL 8.0.19 no longer output integer display width unless ZEROFILL is also used
https://buildkite.com/rails/rails/builds/66475#7a6c54bc-4ed3-4676-b196-4fee031f43bf Fixes #38226.
This commit is contained in:
parent
1d6402042d
commit
36e6a51662
2 changed files with 28 additions and 19 deletions
|
@ -77,11 +77,14 @@ class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase
|
|||
@conn.add_foreign_key :engines, :old_cars
|
||||
end
|
||||
|
||||
assert_includes error.message, <<~MSG.squish
|
||||
Column `old_car_id` on table `engines` does not match column `id` on `old_cars`,
|
||||
which has type `int(11)`. To resolve this issue, change the type of the `old_car_id`
|
||||
column on `engines` to be :integer. (For example `t.integer :old_car_id`).
|
||||
MSG
|
||||
assert_match(
|
||||
%r/Column `old_car_id` on table `engines` does not match column `id` on `old_cars`, which has type `int(\(11\))?`\./,
|
||||
error.message
|
||||
)
|
||||
assert_match(
|
||||
%r/To resolve this issue, change the type of the `old_car_id` column on `engines` to be :integer\. \(For example `t.integer :old_car_id`\)\./,
|
||||
error.message
|
||||
)
|
||||
assert_not_nil error.cause
|
||||
ensure
|
||||
@conn.execute("ALTER TABLE engines DROP COLUMN old_car_id") rescue nil
|
||||
|
@ -101,11 +104,14 @@ class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase
|
|||
SQL
|
||||
end
|
||||
|
||||
assert_includes error.message, <<~MSG.squish
|
||||
Column `old_car_id` on table `foos` does not match column `id` on `old_cars`,
|
||||
which has type `int(11)`. To resolve this issue, change the type of the `old_car_id`
|
||||
column on `foos` to be :integer. (For example `t.integer :old_car_id`).
|
||||
MSG
|
||||
assert_match(
|
||||
%r/Column `old_car_id` on table `foos` does not match column `id` on `old_cars`, which has type `int(\(11\))?`\./,
|
||||
error.message
|
||||
)
|
||||
assert_match(
|
||||
%r/To resolve this issue, change the type of the `old_car_id` column on `foos` to be :integer\. \(For example `t.integer :old_car_id`\)\./,
|
||||
error.message
|
||||
)
|
||||
assert_not_nil error.cause
|
||||
ensure
|
||||
@conn.drop_table :foos, if_exists: true
|
||||
|
@ -125,11 +131,14 @@ class Mysql2AdapterTest < ActiveRecord::Mysql2TestCase
|
|||
SQL
|
||||
end
|
||||
|
||||
assert_includes error.message, <<~MSG.squish
|
||||
Column `car_id` on table `foos` does not match column `id` on `cars`,
|
||||
which has type `bigint(20)`. To resolve this issue, change the type of the `car_id`
|
||||
column on `foos` to be :bigint. (For example `t.bigint :car_id`).
|
||||
MSG
|
||||
assert_match(
|
||||
%r/Column `car_id` on table `foos` does not match column `id` on `cars`, which has type `bigint(\(20\))?`\./,
|
||||
error.message
|
||||
)
|
||||
assert_match(
|
||||
%r/To resolve this issue, change the type of the `car_id` column on `foos` to be :bigint\. \(For example `t.bigint :car_id`\)\./,
|
||||
error.message
|
||||
)
|
||||
assert_not_nil error.cause
|
||||
ensure
|
||||
@conn.drop_table :foos, if_exists: true
|
||||
|
|
|
@ -144,10 +144,10 @@ module ActiveRecord
|
|||
assert_equal "integer", four.sql_type
|
||||
assert_equal "bigint", eight.sql_type
|
||||
elsif current_adapter?(:Mysql2Adapter)
|
||||
assert_match "int(11)", default.sql_type
|
||||
assert_match "tinyint", one.sql_type
|
||||
assert_match "int", four.sql_type
|
||||
assert_match "bigint", eight.sql_type
|
||||
assert_match %r/\Aint/, default.sql_type
|
||||
assert_match %r/\Atinyint/, one.sql_type
|
||||
assert_match %r/\Aint/, four.sql_type
|
||||
assert_match %r/\Abigint/, eight.sql_type
|
||||
elsif current_adapter?(:OracleAdapter)
|
||||
assert_equal "NUMBER(38)", default.sql_type
|
||||
assert_equal "NUMBER(1)", one.sql_type
|
||||
|
|
Loading…
Reference in a new issue