Files
sx-fc/db/migrate/20170403174111_create_sale_audits.rb
2018-10-12 16:33:44 +06:30

20 lines
755 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.text :remark
t.timestamps
end
add_index :sale_audits, :remark, remark: 'remark', type: :fulltext
add_index :sale_audits, [:sale_id, :action, :action_at]
end
end