change transactional primary key to custom ID for better portability
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
class CreateSales < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sales do |t|
|
||||
create_table :sales, :id => false, :primary_key => :sale_id do |t|
|
||||
t.string :sale_id, :limit => 16, :null => false, :index => true, :unique => 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.references :customer, foreign_key: true
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user