28 lines
1.4 KiB
Ruby
28 lines
1.4 KiB
Ruby
class CreateSales < ActiveRecord::Migration[5.1]
|
|
def change
|
|
create_table :sales, :id => false do |t|
|
|
t.string :sale_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
|
|
|
t.integer :cashier_id, :index => true
|
|
t.string :cashier_name
|
|
t.string :requested_by, :null => false
|
|
t.datetime :requested_at, :null => false
|
|
t.string :receipt_no, :null => false
|
|
t.datetime :receipt_date, :null => false
|
|
t.string :customer_id, foreign_key: true, :limit => 16
|
|
t.string :payment_status, :null => false, :default => "outstanding"
|
|
t.string :sale_status, :null => false, :default => "new"
|
|
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.decimal :total_discount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.string :tax_type, :null => false , :dfault => "exclusive_tax"
|
|
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.decimal :rounding_adjustment, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
|
|
|
t.timestamps
|
|
end
|
|
end
|
|
end
|