class CreateSaleAudits < ActiveRecord::Migration[5.1]
  def change
    create_table :sale_audits, :id => false do |t|
      t.string :sale_audit_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 :action, :null => false
      t.datetime :action_at, :null => false
      t.string :action_by, :null => false
      t.string :approved_by, :null => true
      t.datetime :approved_at, :null => true
      t.string :remark
      t.timestamps
    end
  end
end
