diff options
Diffstat (limited to 'activerecord/test/schema/postgresql_specific_schema.rb')
-rw-r--r-- | activerecord/test/schema/postgresql_specific_schema.rb | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb index 3a5d73a0ed..f00b858ea6 100644 --- a/activerecord/test/schema/postgresql_specific_schema.rb +++ b/activerecord/test/schema/postgresql_specific_schema.rb @@ -1,6 +1,6 @@ ActiveRecord::Schema.define do - enable_extension!('uuid-ossp', ActiveRecord::Base.connection) + enable_extension!("uuid-ossp", ActiveRecord::Base.connection) create_table :uuid_parents, id: :uuid, force: true do |t| t.string :name @@ -12,16 +12,16 @@ ActiveRecord::Schema.define do end 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.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: '--- [] ' @@ -32,12 +32,12 @@ ActiveRecord::Schema.define do drop_table table_name, if_exists: true end - execute 'DROP SEQUENCE IF EXISTS companies_nonstd_seq CASCADE' - execute 'CREATE SEQUENCE companies_nonstd_seq START 101 OWNED BY companies.id' + execute "DROP SEQUENCE IF EXISTS companies_nonstd_seq CASCADE" + execute "CREATE SEQUENCE companies_nonstd_seq START 101 OWNED BY companies.id" execute "ALTER TABLE companies ALTER COLUMN id SET DEFAULT nextval('companies_nonstd_seq')" - execute 'DROP SEQUENCE IF EXISTS companies_id_seq' + execute "DROP SEQUENCE IF EXISTS companies_id_seq" - execute 'DROP FUNCTION IF EXISTS partitioned_insert_trigger()' + execute "DROP FUNCTION IF EXISTS partitioned_insert_trigger()" %w(accounts_id_seq developers_id_seq projects_id_seq topics_id_seq customers_id_seq orders_id_seq).each do |seq_name| execute "SELECT setval('#{seq_name}', 100)" @@ -88,7 +88,7 @@ _SQL FOR EACH ROW EXECUTE PROCEDURE partitioned_insert_trigger(); _SQL rescue ActiveRecord::StatementInvalid => e - if e.message =~ /language "plpgsql" does not exist/ + if e.message.include?('language "plpgsql" does not exist') execute "CREATE LANGUAGE 'plpgsql';" retry else @@ -106,4 +106,9 @@ _SQL t.integer :big_int_data_points, limit: 8, array: true t.decimal :decimal_array_default, array: true, default: [1.23, 3.45] end + + create_table :uuid_items, force: true, id: false do |t| + t.uuid :uuid, primary_key: true + t.string :title + end end |