Skip to content

Commit

Permalink
Ajout d'une migration assignant une fréauence de mise à jour par défa…
Browse files Browse the repository at this point in the history
…ut à tous les services et modèles
  • Loading branch information
ggounot committed Dec 30, 2024
1 parent aa7fe52 commit 01cf572
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.17 on 2024-12-30 15:55

from django.db import migrations


def assign_default_update_frequency(apps, schema_editor):
UpdateFrequency = apps.get_model("services", "UpdateFrequency")
Service = apps.get_model("services", "Service")
ServiceModel = apps.get_model("services", "ServiceModel")

default_update_frequency = UpdateFrequency.objects.get(value="tous-les-6-mois")

Service.objects.update(update_frequency=default_update_frequency)
ServiceModel.objects.update(update_frequency=default_update_frequency)


class Migration(migrations.Migration):
dependencies = [
("services", "0115_updatefrequency_service_update_frequency"),
]

operations = [
migrations.RunPython(
assign_default_update_frequency, reverse_code=migrations.RunPython.noop
),
]

0 comments on commit 01cf572

Please sign in to comment.