This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/passbook/providers/saml/migrations/0006_remove_samlprovider_name.py

31 lines
904 B
Python
Raw Normal View History

2020-10-03 18:01:10 +00:00
# Generated by Django 3.1.2 on 2020-10-03 17:37
from django.apps.registry import Apps
from django.db import migrations
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
def update_name_temp(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
SAMLProvider = apps.get_model("passbook_providers_saml", "SAMLProvider")
db_alias = schema_editor.connection.alias
for provider in SAMLProvider.objects.using(db_alias).all():
provider.name_temp = provider.name
provider.save()
class Migration(migrations.Migration):
dependencies = [
("passbook_core", "0011_provider_name_temp"),
("passbook_providers_saml", "0005_remove_samlprovider_processor_path"),
]
operations = [
migrations.RunPython(update_name_temp),
migrations.RemoveField(
model_name="samlprovider",
name="name",
),
]