Reorder migration code
This commit is contained in:
parent
85c4a0f80b
commit
5b1dc5184d
1 changed files with 16 additions and 16 deletions
|
@ -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
|
||||
|
|
Reference in a new issue