jumpserver/apps/orgs/migrations/0014_organization_builtin.py

34 lines
869 B
Python
Raw Normal View History

2022-10-26 09:21:52 +00:00
# Generated by Django 3.2.14 on 2022-10-26 09:07
from django.db import migrations, models
def update_builtin_org(apps, schema_editor):
org_model = apps.get_model('orgs', 'Organization')
org_model.objects.create(
id='00000000-0000-0000-0000-000000000004',
name='SYSTEM', builtin=True
)
# 更新 Default
org_model.objects.filter(name='DEFAULT').update(builtin=True)
class Migration(migrations.Migration):
dependencies = [
('orgs', '0013_alter_organization_options'),
]
operations = [
migrations.AddField(
model_name='organization',
name='builtin',
field=models.BooleanField(default=False, verbose_name='Builtin'),
),
migrations.RunPython(update_builtin_org),
2022-12-19 07:35:28 +00:00
migrations.DeleteModel(
name='OrganizationMember',
),
2022-10-26 09:21:52 +00:00
]