fix(OperateLog): 修复操作日志按时间查询慢

增加表OperateLog datetime字段索引
pull/4464/head
huamaolin 2020-08-07 10:44:27 +08:00 committed by xinwen
parent ffde306a04
commit 25d1b3334f
1 changed files with 1 additions and 1 deletions

View File

@ -58,7 +58,7 @@ class OperateLog(OrgModelMixin):
resource_type = models.CharField(max_length=64, verbose_name=_("Resource Type"))
resource = models.CharField(max_length=128, verbose_name=_("Resource"))
remote_addr = models.CharField(max_length=128, verbose_name=_("Remote addr"), blank=True, null=True)
datetime = models.DateTimeField(auto_now=True, verbose_name=_('Datetime'))
datetime = models.DateTimeField(auto_now=True, verbose_name=_('Datetime'), db_index=True)
def __str__(self):
return "<{}> {} <{}>".format(self.user, self.action, self.resource)