gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/db/migrate/20220611212541_add_role_id_...

11 lines
350 B
Ruby

# frozen_string_literal: true
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