diff --git a/src/consents/migrations/0005_remove_userconsents_provider_schema_and_more.py b/src/consents/migrations/0005_remove_userconsents_provider_schema_and_more.py index 2dffac17584025b4d77354926d5a2c83493260c3..feb994a33f184da5882d6a8c00b3b1ca2dd0d588 100644 --- a/src/consents/migrations/0005_remove_userconsents_provider_schema_and_more.py +++ b/src/consents/migrations/0005_remove_userconsents_provider_schema_and_more.py @@ -1,4 +1,4 @@ -from django.db import migrations, models +from django.db import migrations, models, connection import django.db.models.deletion def migrate_user_consent_to_verb(apps, schema_editor): @@ -8,10 +8,12 @@ def migrate_user_consent_to_verb(apps, schema_editor): schema = consent.provider_schema verb_id = consent.verb verb = Verb.objects.get(verb_id=verb_id, provider_schema=schema) - consent.verb = verb.id + #consent.verb = verb.id group = verb.providerverbgroup_set.first() - consent.verb_group_id = group.id - consent.save() + #consent.verb_group_id = group.id + #consent.save() + with connection.cursor() as cursor: + cursor.execute("UPDATE consents_userconsents SET verb = %s, verb_group_id = %s WHERE id = %s", [verb.id, group.id, consent.id]) class Migration(migrations.Migration):