1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/db/migrate/20240801094244_populate_everyone_role.rb

22 lines
428 B
Ruby
Raw Normal View History

2024-08-01 03:10:31 -07:00
# frozen_string_literal: true
class PopulateEveryoneRole < ActiveRecord::Migration[7.1]
disable_ddl_transaction!
class UserRole < ApplicationRecord
EVERYONE_ROLE_ID = -99
FLAGS = {
invite_users: (1 << 16),
}.freeze
end
def up
UserRole.create!(id: UserRole::EVERYONE_ROLE_ID, permissions: UserRole::FLAGS[:invite_users])
rescue ActiveRecord::RecordNotUnique
nil
end
def down; end
end