Sha256: cccf3fa680eee6d44e06f756cb07104b8b85250c0069cf458a40f1201352539b

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

class CreateUnidomChinaRegions < ActiveRecord::Migration

  def change

    create_table :unidom_china_regions, id: :uuid do |t|

      t.references :scheme, type: :uuid, null: false,
        polymorphic: { null: false, default: '', limit: 200 }

      t.column :numeric_code, 'char(6)', null: false, default: '0'*6
      t.string :alphabetic_code,         null: true,  default: nil, limit: 3

      t.string  :name,    null: false, default: '', limit: 200
      t.boolean :virtual, null: false, default: false

      t.text :instruction
      t.text :description

      t.column   :state, 'char(1)', null: false, default: Unidom::Common::STATE
      t.datetime :opened_at,        null: false, default: Unidom::Common::OPENED_AT
      t.datetime :closed_at,        null: false, default: Unidom::Common::CLOSED_AT
      t.boolean  :defunct,          null: false, default: false
      t.jsonb    :notation,         null: false, default: {}

      t.timestamps null: false

    end

    add_index :unidom_china_regions, :scheme_id
    add_index :unidom_china_regions, [ :numeric_code,    :scheme_id, :scheme_type ], unique: true, name: 'index_unidom_china_regions_on_numeric_code_and_scheme'
    add_index :unidom_china_regions, [ :alphabetic_code, :scheme_id, :scheme_type ], unique: true, name: 'index_unidom_china_regions_on_alphabetic_code_and_scheme'

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unidom-geo-china-1.0 db/migrate/20010491560010_create_unidom_china_regions.rb