Sha256: 26e58ac818fd08c71c9718cf73b58e9f4102234cff7168dab262a4e6a9eb8b37

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

class CreateUnidomOrders < ActiveRecord::Migration

  def change

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

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

      t.column :number, 'char(12)', null: false, default: '0'*12

      t.decimal :purchase_amount,  null: false, default: 0.0, precision: 12, scale: 2
      t.decimal :aggregate_amount, null: false, default: 0.0, precision: 12, scale: 2

      t.text :instruction
      t.text :description

      t.string   :slug,             null: false, default: nil, limit: 200
      t.column   :state, 'char(1)', null: false, default: 'C'
      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_orders, :placer_id
    add_index :unidom_orders, :taker_id
    add_index :unidom_orders, :number, unique: true
    add_index :unidom_orders, :slug,   unique: true

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
unidom-order-2.0 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.9 db/migrate/20020601000000_create_unidom_orders.rb