feat(assign_tos): add manager column to assign_tos table. Same idea as administrateur_procedures.manager which flag a link between procedure/administrateur coming from a SuperAdmin [target: able to avoid SuperAdmin sec issues]

This commit is contained in:
Martin 2022-07-21 13:17:47 +02:00 committed by mfo
parent 33000466a5
commit f0a4cbb61e
4 changed files with 18 additions and 0 deletions

View file

@ -6,6 +6,7 @@
# daily_email_notifications_enabled :boolean default(FALSE), not null
# instant_email_dossier_notifications_enabled :boolean default(FALSE), not null
# instant_email_message_notifications_enabled :boolean default(FALSE), not null
# manager :boolean default(TRUE)
# weekly_email_notifications_enabled :boolean default(TRUE), not null
# created_at :datetime
# updated_at :datetime

View file

@ -0,0 +1,6 @@
class AddManagerToAssignTos < ActiveRecord::Migration[6.1]
def change
add_column :assign_tos, :manager, :boolean
change_column_default :assign_tos, :manager, default: false
end
end

View file

@ -0,0 +1,10 @@
class BackfillAssignTosManager < ActiveRecord::Migration[6.1]
disable_ddl_transaction!
def change
AssignTo.in_batches do |relation|
relation.update_all manager: false
sleep(0.01)
end
end
end

View file

@ -112,6 +112,7 @@ ActiveRecord::Schema.define(version: 2022_07_28_084804) do
t.boolean "instant_email_dossier_notifications_enabled", default: false, null: false
t.boolean "instant_email_message_notifications_enabled", default: false, null: false
t.integer "instructeur_id"
t.boolean "manager", default: true
t.datetime "updated_at"
t.boolean "weekly_email_notifications_enabled", default: true, null: false
t.index ["groupe_instructeur_id", "instructeur_id"], name: "unique_couple_groupe_instructeur_instructeur", unique: true