diff options
Diffstat (limited to 'activerecord/test/schema')
-rw-r--r-- | activerecord/test/schema/mysql2_specific_schema.rb | 29 | ||||
-rw-r--r-- | activerecord/test/schema/postgresql_specific_schema.rb | 37 |
2 files changed, 35 insertions, 31 deletions
diff --git a/activerecord/test/schema/mysql2_specific_schema.rb b/activerecord/test/schema/mysql2_specific_schema.rb index 92e0b197a7..701e6f45b3 100644 --- a/activerecord/test/schema/mysql2_specific_schema.rb +++ b/activerecord/test/schema/mysql2_specific_schema.rb @@ -1,18 +1,25 @@ ActiveRecord::Schema.define do + + if ActiveRecord::Base.connection.version >= '5.6.0' + create_table :datetime_defaults, force: true do |t| + t.datetime :modified_datetime, default: -> { 'CURRENT_TIMESTAMP' } + end + end + create_table :binary_fields, force: true do |t| t.binary :var_binary, limit: 255 t.binary :var_binary_large, limit: 4095 - t.blob :tiny_blob, limit: 255 - t.binary :normal_blob, limit: 65535 - t.binary :medium_blob, limit: 16777215 - t.binary :long_blob, limit: 2147483647 - t.text :tiny_text, limit: 255 - t.text :normal_text, limit: 65535 - t.text :medium_text, limit: 16777215 - t.text :long_text, limit: 2147483647 - end + t.tinyblob :tiny_blob + t.blob :normal_blob + t.mediumblob :medium_blob + t.longblob :long_blob + t.tinytext :tiny_text + t.text :normal_text + t.mediumtext :medium_text + t.longtext :long_text - add_index :binary_fields, :var_binary + t.index :var_binary + end create_table :key_tests, force: true, :options => 'ENGINE=MyISAM' do |t| t.string :awesome @@ -55,7 +62,7 @@ SQL ActiveRecord::Base.connection.execute <<-SQL CREATE TABLE enum_tests ( - enum_column ENUM('text','blob','tiny','medium','long') + enum_column ENUM('text','blob','tiny','medium','long','unsigned') ) SQL end diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb index df0362573b..3a5d73a0ed 100644 --- a/activerecord/test/schema/postgresql_specific_schema.rb +++ b/activerecord/test/schema/postgresql_specific_schema.rb @@ -11,7 +11,23 @@ ActiveRecord::Schema.define do t.uuid :uuid_parent_id end - %w(postgresql_times postgresql_oids defaults postgresql_timestamp_with_zones + create_table :defaults, force: true do |t| + t.date :modified_date, default: -> { 'CURRENT_DATE' } + t.date :modified_date_function, default: -> { 'now()' } + t.date :fixed_date, default: '2004-01-01' + t.datetime :modified_time, default: -> { 'CURRENT_TIMESTAMP' } + t.datetime :modified_time_function, default: -> { 'now()' } + t.datetime :fixed_time, default: '2004-01-01 00:00:00.000000-00' + t.column :char1, 'char(1)', default: 'Y' + t.string :char2, limit: 50, default: 'a varchar field' + t.text :char3, default: 'a text field' + t.bigint :bigint_default, default: -> { '0::bigint' } + t.text :multiline_default, default: '--- [] + +' + end + + %w(postgresql_times postgresql_oids postgresql_timestamp_with_zones postgresql_partitioned_table postgresql_partitioned_table_parent).each do |table_name| drop_table table_name, if_exists: true end @@ -28,25 +44,6 @@ ActiveRecord::Schema.define do end execute <<_SQL - CREATE TABLE defaults ( - id serial primary key, - modified_date date default CURRENT_DATE, - modified_date_function date default now(), - fixed_date date default '2004-01-01', - modified_time timestamp default CURRENT_TIMESTAMP, - modified_time_function timestamp default now(), - fixed_time timestamp default '2004-01-01 00:00:00.000000-00', - char1 char(1) default 'Y', - char2 character varying(50) default 'a varchar field', - char3 text default 'a text field', - bigint_default bigint default 0::bigint, - multiline_default text DEFAULT '--- [] - -'::text -); -_SQL - - execute <<_SQL CREATE TABLE postgresql_times ( id SERIAL PRIMARY KEY, time_interval INTERVAL, |