Files
sx-fc/db/migrate/20170403161857_create_sale_items.rb
2018-03-05 10:28:36 +06:30

23 lines
1.0 KiB
Ruby
Executable File

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 :item_instance_code
t.string :product_name, :null => false
t.string :product_alt_name, :null => false
t.integer :account_id, :limit => 8, :null => false, :default => 1
t.string :status
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