Sha256: 0bdd94eeb24b014586aa5bd738aa758372716b297b220561aa2f20eab84b503f

Contents?: true

Size: 1.26 KB

Versions: 21

Compression:

Stored size: 1.26 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: ::Time.utc(1970)
      t.datetime :closed_at,        null: false, default: ::Time.utc(3000)
      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

21 entries across 21 versions & 1 rubygems

Version Path
unidom-order-1.5.8 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.7 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.6 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.5 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.4 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.3 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.2 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5.1 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.5 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.4.2 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.4.1 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.4 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.3.3 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.3.2 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.3.1 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.3 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.2 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.1 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.0.1 db/migrate/20020601000000_create_unidom_orders.rb
unidom-order-1.0 db/migrate/20020601000000_create_unidom_orders.rb