aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-07-07 02:56:32 +0900
committerGitHub <noreply@github.com>2019-07-07 02:56:32 +0900
commita05a9b0e26d055131a4ed93f2b68abd4f792b376 (patch)
tree28c535f317cfc4e783b94008ae1a74204e2b5e3d /activerecord/lib/active_record/schema_dumper.rb
parent6a9061481627aad117dc5147da33bff309648ddb (diff)
parent52729fb5f24ff96c812327ff045b9a1921d37a7c (diff)
downloadrails-a05a9b0e26d055131a4ed93f2b68abd4f792b376.tar.gz
rails-a05a9b0e26d055131a4ed93f2b68abd4f792b376.tar.bz2
rails-a05a9b0e26d055131a4ed93f2b68abd4f792b376.zip
Merge pull request #36604 from kamipo/fix_schema_dumping_enum
MySQL: Fix schema dumping `enum` and `set` columns correctly
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index 2f7cc07221..f4b1f536b3 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -146,7 +146,11 @@ HEADER
raise StandardError, "Unknown type '#{column.sql_type}' for column '#{column.name}'" unless @connection.valid_type?(column.type)
next if column.name == pk
type, colspec = column_spec(column)
- tbl.print " t.#{type} #{column.name.inspect}"
+ if type.is_a?(Symbol)
+ tbl.print " t.#{type} #{column.name.inspect}"
+ else
+ tbl.print " t.column #{column.name.inspect}, #{type.inspect}"
+ end
tbl.print ", #{format_colspec(colspec)}" if colspec.present?
tbl.puts
end