Browse Source

[Update] 增加索引

pull/2230/head
ibuler 6 years ago
parent
commit
7773c30240
  1. 1
      apps/assets/models/node.py
  2. 13
      apps/ops/migrations/0005_auto_20181219_1807.py
  3. 2
      apps/ops/models/adhoc.py
  4. 2
      apps/ops/models/celery.py

1
apps/assets/models/node.py

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

13
apps/ops/migrations/0005_auto_20181219_1807.py

@ -15,4 +15,17 @@ class Migration(migrations.Migration):
name='date_created',
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),
),
]

2
apps/ops/models/adhoc.py

@ -164,7 +164,7 @@ class AdHoc(models.Model):
run_as = models.ForeignKey('assets.SystemUser', null=True, on_delete=models.CASCADE)
_become = models.CharField(max_length=1024, default='', verbose_name=_("Become"))
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
def tasks(self):

2
apps/ops/models/celery.py

@ -19,7 +19,7 @@ class CeleryTask(models.Model):
)
id = models.UUIDField(primary_key=True, default=uuid.uuid4)
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)
date_published = models.DateTimeField(auto_now_add=True)
date_start = models.DateTimeField(null=True)

Loading…
Cancel
Save