factory/apps/enp/migrations/0002_auto_20240119_1053.py

116 lines
5.1 KiB
Python

# Generated by Django 3.2.12 on 2024-01-19 02:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('enp', '0001_initial'),
]
operations = [
migrations.RunSQL(
sql=[(
"""
CREATE TABLE public.enp_envdata (
"time" timestamp NOT NULL,
"equipment_id" text NOT NULL,
"is_online" INT DEFAULT 1,
"running_state" INT DEFAULT 10,
"dust_rtd" decimal,
"dust_zs" decimal,
"temperature" decimal,
"pressure" decimal,
"speed" decimal,
"humidity" decimal,
"flux" decimal,
"pm25" decimal,
"pm10" decimal,
"tsp" decimal,
"wind_direction" INT,
"wind_speed" decimal,
"so2_rtd" decimal,
"so2_zs" decimal,
"nox_rtd" decimal,
"nox_zs" decimal,
"o2" decimal,
CONSTRAINT enp_envdata_pkey PRIMARY KEY (time, equipment_id)
);
SELECT create_hypertable('enp_envdata', 'time');
"""
)],
reverse_sql=[
"DROP TABLE IF EXISTS public.enp_envdata;"
]
),
migrations.CreateModel(
name='EnvData',
fields=[
('time', models.DateTimeField(primary_key=True,
serialize=False, verbose_name='采集时间')),
('is_online', models.PositiveSmallIntegerField(
default=1, verbose_name='是否在线')),
('running_state', models.PositiveSmallIntegerField(
default=10, verbose_name='运行状态')),
('dust_rtd', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='颗粒物实测(mg/m3)')),
('dust_zs', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='颗粒物折算(mg/m3)')),
('temperature', models.DecimalField(
blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='温度(℃)')),
('pressure', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='压力(kPa)')),
('speed', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='流速(m/s)')),
('humidity', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='湿度(%)')),
('flux', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='流量(m3/h)')),
('pm25', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='PM2.5(ug/m3)')),
('pm10', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='PM10(ug/m3)')),
('tsp', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='TSP(ug/m3)')),
('wind_direction', models.PositiveSmallIntegerField(
blank=True, null=True, verbose_name='风向')),
('wind_speed', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='风速(m/s)')),
('so2_rtd', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='二氧化硫实测(mg/m3)')),
('so2_zs', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='二氧化硫折算(mg/m3)')),
('nox_rtd', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='氮氧化物实测(mg/m3)')),
('nox_zs', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='氮氧化物折算(mg/m3)')),
('o2', models.DecimalField(blank=True, decimal_places=4,
max_digits=10, null=True, verbose_name='含氧量(%)')),
],
options={
'db_table': 'enp_envdata',
'managed': False,
},
),
migrations.AddField(
model_name='drainequip',
name='dust_alarm',
field=models.DecimalField(
blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='颗粒物报警值'),
),
migrations.AlterField(
model_name='drainequip',
name='drain',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='drainequip_drain', to='enp.drain', verbose_name='排口'),
),
migrations.AlterField(
model_name='drainequip',
name='equipment',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
related_name='drainequip_equipment', to='em.equipment', verbose_name='关联设备'),
),
]