diff options
author | Matthew Draper <matthew@trebex.net> | 2017-07-09 02:58:56 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-09 02:58:56 +0930 |
commit | 8fdc166e564da87ec3fe66837ffa98de57fd85c8 (patch) | |
tree | 30f16cf9f7f2cac3dcfe1ee2cd652e90d6681f45 /activerecord | |
parent | fac5fe09d3f334b8dc3cd800a2fcdc849f9874af (diff) | |
parent | f4e2807a1a72873af5630fa19888ea5bd61aaafa (diff) | |
download | rails-8fdc166e564da87ec3fe66837ffa98de57fd85c8.tar.gz rails-8fdc166e564da87ec3fe66837ffa98de57fd85c8.tar.bz2 rails-8fdc166e564da87ec3fe66837ffa98de57fd85c8.zip |
Merge pull request #29706 from kamipo/use_information_schema_to_extract_expression
Use `information_schema` to extract `generation_expression` for MariaDB
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/virtual_column_test.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb index eff96e329f..a46d9f8cbb 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql/schema_dumper.rb @@ -53,7 +53,7 @@ module ActiveRecord end def extract_expression_for_virtual_column(column) - if mariadb? + if mariadb? && version < "10.2.5" create_table_info = create_table_info(column.table_name) if %r/#{quote_column_name(column.name)} #{Regexp.quote(column.sql_type)}(?: COLLATE \w+)? AS \((?<expression>.+?)\) #{column.extra}/ =~ create_table_info $~[:expression].inspect diff --git a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb index 442a4fb7b5..1c5ef2aa41 100644 --- a/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb +++ b/activerecord/test/cases/adapters/mysql2/virtual_column_test.rb @@ -52,7 +52,7 @@ if ActiveRecord::Base.connection.supports_virtual_columns? def test_schema_dumping output = dump_table_schema("virtual_columns") - assert_match(/t\.virtual\s+"upper_name",\s+type: :string,\s+as: "UPPER\(`name`\)"$/i, output) + assert_match(/t\.virtual\s+"upper_name",\s+type: :string,\s+as: "(?:UPPER|UCASE)\(`name`\)"$/i, output) assert_match(/t\.virtual\s+"name_length",\s+type: :integer,\s+as: "LENGTH\(`name`\)",\s+stored: true$/i, output) end end |