Files
sx-fc/db/migrate/20170403174111_create_sale_audits.rb
2018-08-20 11:26:07 +06:30

18 lines
710 B
Ruby
Executable File

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, :index => true, :limit => 16
t.string :action, :null => false, :index => true
t.datetime :action_at, :null => false, :index => true
t.string :action_by, :null => false
t.string :approved_by, :null => true
t.datetime :approved_at, :null => true
t.string :remark, :index => true
t.timestamps
end
add_index :sale_audits, [:sale_id, :action, :action_at, :remark]
end
end