[Update] 增加索引

pull/2230/head
ibuler 6 years ago
parent 231c907c64
commit 7773c30240

@ -29,7 +29,6 @@ class Node(OrgModelMixin):
class Meta: class Meta:
verbose_name = _("Node") verbose_name = _("Node")
ordering = ('key',)
def __str__(self): def __str__(self):
return self.full_value return self.full_value

@ -15,4 +15,17 @@ class Migration(migrations.Migration):
name='date_created', name='date_created',
field=models.DateTimeField(auto_now_add=True, db_index=True), field=models.DateTimeField(auto_now_add=True, db_index=True),
), ),
migrations.AlterField(
model_name='adhoc',
name='date_created',
field=models.DateTimeField(auto_now_add=True, db_index=True),
),
migrations.AlterField(
model_name='celerytask',
name='status',
field=models.CharField(
choices=[('waiting', 'waiting'), ('running', 'running'),
('finished', 'finished')], db_index=True,
max_length=128),
),
] ]

@ -164,7 +164,7 @@ class AdHoc(models.Model):
run_as = models.ForeignKey('assets.SystemUser', null=True, on_delete=models.CASCADE) run_as = models.ForeignKey('assets.SystemUser', null=True, on_delete=models.CASCADE)
_become = models.CharField(max_length=1024, default='', verbose_name=_("Become")) _become = models.CharField(max_length=1024, default='', verbose_name=_("Become"))
created_by = models.CharField(max_length=64, default='', null=True, verbose_name=_('Create by')) created_by = models.CharField(max_length=64, default='', null=True, verbose_name=_('Create by'))
date_created = models.DateTimeField(auto_now_add=True) date_created = models.DateTimeField(auto_now_add=True, db_index=True)
@property @property
def tasks(self): def tasks(self):

@ -19,7 +19,7 @@ class CeleryTask(models.Model):
) )
id = models.UUIDField(primary_key=True, default=uuid.uuid4) id = models.UUIDField(primary_key=True, default=uuid.uuid4)
name = models.CharField(max_length=1024) name = models.CharField(max_length=1024)
status = models.CharField(max_length=128, choices=STATUS_CHOICES) status = models.CharField(max_length=128, choices=STATUS_CHOICES, db_index=True)
log_path = models.CharField(max_length=256, blank=True, null=True) log_path = models.CharField(max_length=256, blank=True, null=True)
date_published = models.DateTimeField(auto_now_add=True) date_published = models.DateTimeField(auto_now_add=True)
date_start = models.DateTimeField(null=True) date_start = models.DateTimeField(null=True)

Loading…
Cancel
Save