mirror of https://github.com/jumpserver/jumpserver
perf: migrations type length
parent
c80ca5236d
commit
e4d169cabe
|
@ -5,7 +5,7 @@ from django.db import migrations, models
|
||||||
|
|
||||||
def migrate_execution_type(apps, schema_editor):
|
def migrate_execution_type(apps, schema_editor):
|
||||||
count = 0
|
count = 0
|
||||||
bulk_size = 100
|
bulk_size = 1000
|
||||||
while True:
|
while True:
|
||||||
start = time.time()
|
start = time.time()
|
||||||
execution_model = apps.get_model('assets', 'AutomationExecution')
|
execution_model = apps.get_model('assets', 'AutomationExecution')
|
||||||
|
@ -33,7 +33,7 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='automationexecution',
|
model_name='automationexecution',
|
||||||
name='type',
|
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)
|
migrations.RunPython(migrate_execution_type)
|
||||||
]
|
]
|
||||||
|
|
|
@ -142,7 +142,7 @@ class AutomationExecution(OrgModelMixin):
|
||||||
null=True, verbose_name=_("Date start"), db_index=True
|
null=True, verbose_name=_("Date start"), db_index=True
|
||||||
)
|
)
|
||||||
date_finished = models.DateTimeField(null=True, verbose_name=_("Date finished"))
|
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"))
|
duration = models.DecimalField(default=0, max_digits=10, decimal_places=2, verbose_name=_("Duration"))
|
||||||
snapshot = EncryptJsonDictTextField(
|
snapshot = EncryptJsonDictTextField(
|
||||||
default=dict, blank=True, null=True, verbose_name=_("Automation snapshot")
|
default=dict, blank=True, null=True, verbose_name=_("Automation snapshot")
|
||||||
|
|
Loading…
Reference in New Issue