Merge pull request #7715 from betagouv/fix_avis_email_migration
fix(migration): correction de la migration avis email notification
This commit is contained in:
commit
65523b5294
5 changed files with 26 additions and 5 deletions
|
@ -6,7 +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
|
||||
# instant_expert_avis_email_notifications_enabled :boolean default(FALSE), not null
|
||||
# instant_expert_avis_email_notifications_enabled :boolean default(FALSE)
|
||||
# manager :boolean default(FALSE)
|
||||
# weekly_email_notifications_enabled :boolean default(TRUE), not null
|
||||
# created_at :datetime
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
class AddAvisEmailNotification < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
add_column :assign_tos, :instant_expert_avis_email_notifications_enabled, :boolean, default: false, null: false
|
||||
def up
|
||||
add_column :assign_tos, :instant_expert_avis_email_notifications_enabled, :boolean
|
||||
change_column_default :assign_tos, :instant_expert_avis_email_notifications_enabled, false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :assign_tos, :instant_expert_avis_email_notifications_enabled
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class BackfillAddAvisEmailNotification < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
AssignTo.in_batches do |relation|
|
||||
relation.update_all instant_expert_avis_email_notifications_enabled: false
|
||||
sleep(0.01)
|
||||
end
|
||||
|
||||
add_check_constraint :assign_tos, "instant_expert_avis_email_notifications_enabled IS NOT NULL", name: "assign_tos_instant_expert_avis_email_notifications_enabled_null", validate: false
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class ValidateBackfillAddAvisEmailNotification < ActiveRecord::Migration[6.1]
|
||||
def change
|
||||
validate_check_constraint :assign_tos, name: "assign_tos_instant_expert_avis_email_notifications_enabled_null"
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2022_08_30_125703) do
|
||||
ActiveRecord::Schema.define(version: 2022_09_02_151920) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "pgcrypto"
|
||||
|
@ -111,7 +111,7 @@ ActiveRecord::Schema.define(version: 2022_08_30_125703) do
|
|||
t.bigint "groupe_instructeur_id"
|
||||
t.boolean "instant_email_dossier_notifications_enabled", default: false, null: false
|
||||
t.boolean "instant_email_message_notifications_enabled", default: false, null: false
|
||||
t.boolean "instant_expert_avis_email_notifications_enabled", default: false, null: false
|
||||
t.boolean "instant_expert_avis_email_notifications_enabled", default: false
|
||||
t.integer "instructeur_id"
|
||||
t.boolean "manager", default: false
|
||||
t.datetime "updated_at"
|
||||
|
@ -119,6 +119,7 @@ ActiveRecord::Schema.define(version: 2022_08_30_125703) do
|
|||
t.index ["groupe_instructeur_id", "instructeur_id"], name: "unique_couple_groupe_instructeur_instructeur", unique: true
|
||||
t.index ["groupe_instructeur_id"], name: "index_assign_tos_on_groupe_instructeur_id"
|
||||
t.index ["instructeur_id"], name: "index_assign_tos_on_instructeur_id"
|
||||
t.check_constraint "instant_expert_avis_email_notifications_enabled IS NOT NULL", name: "assign_tos_instant_expert_avis_email_notifications_enabled_null"
|
||||
end
|
||||
|
||||
create_table "attestation_templates", id: :serial, force: :cascade do |t|
|
||||
|
|
Loading…
Reference in a new issue