Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehenry committed Jan 11, 2022
1 parent b4ede7f commit 8edd50e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion aidants_connect_web/migrations/0050_auto_20210321_2154.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
from django.db import migrations

from aidants_connect.constants import RequestOriginConstants
Expand All @@ -6,7 +7,7 @@
def add_organisation_types(apps, schema_editor):
OrganisationType = apps.get_model("aidants_connect_web", "OrganisationType")
for type in RequestOriginConstants:
OrganisationType.objects.get_or_create(pk=type.value, name=type.label)
OrganisationType.objects.get_or_create(id=type.value, name=type.label)


class Migration(migrations.Migration):
Expand All @@ -17,4 +18,10 @@ class Migration(migrations.Migration):

operations = [
migrations.RunPython(add_organisation_types),
# Resets the starting value for AutoField
# See https://docs.djangoproject.com/en/dev/ref/databases/#manually-specified-autoincrement-pk
migrations.RunSQL(
"""SELECT setval(pg_get_serial_sequence('"aidants_connect_web_organisationtype"','id'), coalesce(max("id"), 1), max("id") IS NOT null)
FROM "aidants_connect_web_organisationtype";"""
),
]

0 comments on commit 8edd50e

Please sign in to comment.