Initial commit
This commit is contained in:
17
db/migrate/20180516110336_improve_account_model.rb
Normal file
17
db/migrate/20180516110336_improve_account_model.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# encoding: UTF-8
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ImproveAccountModel < ActiveRecord::Migration[4.2]
|
||||
def change
|
||||
change_column :accounts, :member_id, :integer, null: false
|
||||
change_column :accounts, :currency_id, :integer, null: false
|
||||
change_column_null :accounts, :balance, false
|
||||
change_column_null :accounts, :locked, false
|
||||
change_column_null :accounts, :created_at, false
|
||||
change_column_null :accounts, :updated_at, false
|
||||
change_column_default :accounts, :balance, 0
|
||||
change_column_default :accounts, :locked, 0
|
||||
remove_index :accounts, column: %i[member_id currency_id]
|
||||
add_index :accounts, %i[currency_id member_id], unique: true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user