You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
319 B
9 lines
319 B
2 years ago
|
class AddRoleIdToUsers < ActiveRecord::Migration[6.1]
|
||
|
disable_ddl_transaction!
|
||
|
|
||
|
def change
|
||
|
safety_assured { add_reference :users, :role, foreign_key: { to_table: 'user_roles', on_delete: :nullify }, index: false }
|
||
|
add_index :users, :role_id, algorithm: :concurrently, where: 'role_id IS NOT NULL'
|
||
|
end
|
||
|
end
|