chore: mosqpost 添加索引
This commit is contained in:
parent
7a8e689038
commit
656e062040
|
@ -0,0 +1,22 @@
|
|||
# Generated by Django 2.2.4 on 2024-03-25 11:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mosquito', '0028_deviceinfo_count'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='mosqpost',
|
||||
name='device_id',
|
||||
field=models.CharField(db_index=True, max_length=100, verbose_name='设备ID'),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='mosqpost',
|
||||
unique_together={('device_id', 'create_time')},
|
||||
),
|
||||
]
|
|
@ -3,7 +3,7 @@ from smart.models import SmartModule, SmartPush
|
|||
|
||||
|
||||
class MosqPost(models.Model):
|
||||
device_id = models.CharField(max_length=100, verbose_name='设备ID')
|
||||
device_id = models.CharField(db_index=True, max_length=100, verbose_name='设备ID')
|
||||
count = models.PositiveIntegerField(verbose_name="灭蚊数量")
|
||||
load = models.CharField(max_length=100, blank=True, null=True, verbose_name='负载电压电流功率')
|
||||
storage_battery = models.CharField(max_length=100, blank=True, null=True, verbose_name='电池电压电流功率')
|
||||
|
@ -14,6 +14,9 @@ class MosqPost(models.Model):
|
|||
update_time = models.DateTimeField(auto_now=True, blank=True, null=True, verbose_name='更新时间')
|
||||
|
||||
class Meta:
|
||||
unique_together = (
|
||||
('device_id', 'create_time'),
|
||||
)
|
||||
verbose_name = '灭蚊灯数据'
|
||||
verbose_name_plural = verbose_name
|
||||
|
||||
|
|
Loading…
Reference in New Issue