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/oauth2/migrations/0006_remove_oauth2provider_name.py

31 lines
900 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):
OAuth2Provider = apps.get_model("passbook_providers_oauth2", "OAuth2Provider")
db_alias = schema_editor.connection.alias
for provider in OAuth2Provider.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_oauth2", "0005_auto_20200920_1240"),
]
operations = [
migrations.RunPython(update_name_temp),
migrations.RemoveField(
model_name="oauth2provider",
name="name",
),
]