perf: migrations type length

pull/15038/head
wangruidong 2025-03-14 15:07:18 +08:00
parent c80ca5236d
commit 5eeb98b15a
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ from django.db import migrations, models
def migrate_execution_type(apps, schema_editor):
count = 0
bulk_size = 100
bulk_size = 1000
while True:
start = time.time()
execution_model = apps.get_model('assets', 'AutomationExecution')
@ -33,7 +33,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='automationexecution',
name='type',
field=models.CharField(default='', max_length=16, verbose_name='Type'),
field=models.CharField(default='', max_length=32, verbose_name='Type'),
),
migrations.RunPython(migrate_execution_type)
]

View File

@ -142,7 +142,7 @@ class AutomationExecution(OrgModelMixin):
null=True, verbose_name=_("Date start"), db_index=True
)
date_finished = models.DateTimeField(null=True, verbose_name=_("Date finished"))
type = models.CharField(default='', max_length=16, verbose_name=_("Type"))
type = models.CharField(default='', max_length=32, verbose_name=_("Type"))
duration = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=_("Duration"))
snapshot = EncryptJsonDictTextField(
default=dict, blank=True, null=True, verbose_name=_("Automation snapshot")