This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2023-07-12 00:47:08 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-07-04 17:41:40 -07:00
|
|
|
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
|