Files
sx-fc/db/migrate/20170403161857_create_sale_items.rb

19 lines
934 B
Ruby

class CreateSaleItems < ActiveRecord::Migration[5.0]
def change
create_table :sale_items, :id => false, :primary_key => :sale_item_id do |t|
t.string :sale_item_id, :limit => 16, :null => false, :index => true, :unique => 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