Sha256: 5442a640f9d9cc318e71622f8522d44b1603ec0287d6224bb3ec47961f4887f0

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

ActiveRecord::Schema.define do
  execute('CREATE extension IF NOT EXISTS "hstore";')
  execute('CREATE extension IF NOT EXISTS "uuid-ossp";')

  create_table :vendors, id: :uuid, force: :cascade do |t|
    t.string :name, null: true
    t.text :preferences

    if t.respond_to?(:json)
      t.json :data
    else
      t.text :data
    end

    if t.respond_to?(:hstore)
      t.hstore :config
    else
      t.text :config
    end

    if t.respond_to?(:jsonb)
      t.jsonb :settings
    else
      t.text :settings
    end

    t.datetime :created_at
    t.datetime :updated_at
  end

  create_table :alarms, force: true do |t|
    t.column :device_id, :integer, null: false
    t.column :alarm_type, :integer, null: false
    t.column :status, :integer, null: false
    t.column :metadata, :text
    t.datetime :created_at
    t.datetime :updated_at
  end

  add_index :alarms, [:device_id, :alarm_type], unique: true, where: 'status <> 0'
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-import-0.17.1 test/schema/postgresql_schema.rb
activerecord-import-0.17.0 test/schema/postgresql_schema.rb
activerecord-import-0.16.2 test/schema/postgresql_schema.rb
activerecord-import-0.16.1 test/schema/postgresql_schema.rb
activerecord-import-0.16.0 test/schema/postgresql_schema.rb