From a2ad8f456e29f760f78333e14474868a63a22a6f Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 25 Oct 2018 10:11:31 +0900 Subject: Support default expression for MySQL MySQL 8.0.13 and higher supports default value to be a function or expression. https://dev.mysql.com/doc/refman/8.0/en/create-table.html --- activerecord/test/schema/mysql2_specific_schema.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activerecord/test/schema') diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index 499280cb0c..ccca9a2d9b 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -19,6 +19,9 @@ ActiveRecord::Schema.define do t.datetime :fixed_time, default: "2004-01-01 00:00:00" t.column :char1, "char(1)", default: "Y" t.string :char2, limit: 50, default: "a varchar field" + if supports_default_expression? + t.binary :uuid, limit: 36, default: -> { "(uuid())" } + end end create_table :binary_fields, force: true do |t| -- cgit v1.2.3