Files
sx-fc/db/migrate/20170403161857_create_sale_items.rb
2017-06-07 18:47:50 +06:30

19 lines
875 B
Ruby

class CreateSaleItems < ActiveRecord::Migration[5.1]
def change
create_table :sale_items, :id => false do |t|
t.string :sale_item_id, :limit => 16, :primary_key => true#custom primary key - to ensure consistence for cloud syncing
t.string :sale_id, foreign_key: true, :limit => 16
t.string :product_code, :null => false
t.string :product_name, :null => false
t.string :remark
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :taxable_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.boolean :is_taxable, :null => false, :default => true
t.timestamps
end
end
end