diff --git a/app/models/assign_to.rb b/app/models/assign_to.rb index 44b73cf60..675e416e4 100644 --- a/app/models/assign_to.rb +++ b/app/models/assign_to.rb @@ -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 diff --git a/db/migrate/20220712141913_add_manager_to_assign_tos.rb b/db/migrate/20220712141913_add_manager_to_assign_tos.rb new file mode 100644 index 000000000..09d5a1906 --- /dev/null +++ b/db/migrate/20220712141913_add_manager_to_assign_tos.rb @@ -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 diff --git a/db/migrate/20220712141945_backfill_assign_tos_manager.rb b/db/migrate/20220712141945_backfill_assign_tos_manager.rb new file mode 100644 index 000000000..805ea367c --- /dev/null +++ b/db/migrate/20220712141945_backfill_assign_tos_manager.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 45a4b1464..372c927c7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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