foodsoft/db/migrate/009_create_order_results.rb

42 lines
1.6 KiB
Ruby
Raw Normal View History

class CreateOrderResults < ActiveRecord::Migration[4.2]
2009-01-06 11:49:19 +01:00
def self.up
create_table :group_order_results do |t|
t.column :order_id, :int, null: false
t.column :group_name, :string, null: false
t.column :price, :decimal, precision: 8, scale: 2, null: false, default: 0
2009-01-06 11:49:19 +01:00
end
add_index(:group_order_results, %i[group_name order_id], unique: true)
2009-01-06 11:49:19 +01:00
create_table :order_article_results do |t|
t.column :order_id, :int, null: false
t.column :name, :string, null: false
t.column :unit, :string, null: false
2009-01-06 11:49:19 +01:00
t.column :note, :string
t.column :clear_price, :decimal, precision: 8, scale: 2, null: false
t.column :gross_price, :decimal, precision: 8, scale: 2, null: false
t.column :tax, :float, null: false, default: 0
t.column :refund, :decimal, precision: 8, scale: 2
t.column :fc_markup, :float, null: false
2009-01-06 11:49:19 +01:00
t.column :order_number, :string
t.column :unit_quantity, :int, null: false
t.column :units_to_order, :int, null: false
2009-01-06 11:49:19 +01:00
end
add_index(:order_article_results, :order_id)
2009-01-06 11:49:19 +01:00
create_table :group_order_article_results do |t|
t.column :order_article_result_id, :int, null: false
t.column :group_order_result_id, :int, null: false
t.column :quantity, :int, null: false
2009-01-06 11:49:19 +01:00
t.column :tolerance, :int
end
add_index(:group_order_article_results, :order_article_result_id)
add_index(:group_order_article_results, :group_order_result_id)
end
def self.down
drop_table :group_order_results
drop_table :order_article_results
drop_table :group_order_article_results
end
end