1
0
Fork 0

Reorder migration code

This commit is contained in:
Alex Kotov 2019-07-20 05:41:59 +05:00
parent 85c4a0f80b
commit 5b1dc5184d
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08

View file

@ -2,6 +2,22 @@
class DeviseCreateUsers < ActiveRecord::Migration[5.2]
def change
create_table :country_states do |t|
t.timestamps null: false
t.string :name, null: false
t.index :name, unique: true
end
create_table :regional_offices do |t|
t.timestamps null: false
t.references :country_state,
null: false,
index: { unique: true },
foreign_key: true
end
create_table :people do |t|
t.timestamps null: false
end
@ -72,13 +88,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2]
t.index %i[account_id role_id], unique: true
end
create_table :country_states do |t|
t.timestamps null: false
t.string :name, null: false
t.index :name, unique: true
end
create_table :user_omniauths do |t|
t.timestamps null: false
@ -90,15 +99,6 @@ class DeviseCreateUsers < ActiveRecord::Migration[5.2]
t.index %i[remote_id provider], unique: true
end
create_table :regional_offices do |t|
t.timestamps null: false
t.references :country_state,
null: false,
index: { unique: true },
foreign_key: true
end
add_foreign_key :users, :accounts
add_foreign_key :account_roles, :accounts
add_foreign_key :account_roles, :roles