Files
2026-05-11 03:27:21 +03:30

89 lines
4.8 KiB
Python

# Generated by Django 5.2.11 on 2026-02-27 09:47
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('location_data', '0002_soildepthdata_refactor'),
]
operations = [
migrations.CreateModel(
name='SensorDataHistory',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('uuid_sensor', models.UUIDField(help_text='شناسه سنسور')),
('location_id', models.IntegerField(help_text='location_id از location_data')),
('soil_moisture', models.FloatField(blank=True, null=True)),
('soil_temperature', models.FloatField(blank=True, null=True)),
('soil_ph', models.FloatField(blank=True, null=True)),
('electrical_conductivity', models.FloatField(blank=True, null=True)),
('nitrogen', models.FloatField(blank=True, null=True)),
('phosphorus', models.FloatField(blank=True, null=True)),
('potassium', models.FloatField(blank=True, null=True)),
('recorded_at', models.DateTimeField(auto_now_add=True, help_text='زمان ثبت در تاریخچه')),
],
options={
'verbose_name': 'تاریخچه داده سنسور',
'verbose_name_plural': 'تاریخچه داده\u200cهای سنسور',
'ordering': ['-recorded_at'],
},
),
migrations.CreateModel(
name='SensorParameter',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(db_index=True, help_text='کد یکتا (مثلاً soil_moisture)', max_length=64, unique=True)),
('name_fa', models.CharField(help_text='نام فارسی', max_length=128)),
('unit', models.CharField(blank=True, help_text='واحد اندازه\u200cگیری', max_length=32)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'verbose_name': 'پارامتر سنسور',
'verbose_name_plural': 'پارامترهای سنسور',
'ordering': ['code'],
},
),
migrations.CreateModel(
name='SensorData',
fields=[
('uuid_sensor', models.UUIDField(default=uuid.uuid4, editable=False, help_text='شناسه یکتای سنسور', primary_key=True, serialize=False)),
('soil_moisture', models.FloatField(blank=True, help_text='رطوبت خاک', null=True)),
('soil_temperature', models.FloatField(blank=True, help_text='دما خاک', null=True)),
('soil_ph', models.FloatField(blank=True, help_text='pH خاک', null=True)),
('electrical_conductivity', models.FloatField(blank=True, help_text='هدایت الکتریکی', null=True)),
('nitrogen', models.FloatField(blank=True, help_text='ازت (N)', null=True)),
('phosphorus', models.FloatField(blank=True, help_text='فسفر', null=True)),
('potassium', models.FloatField(blank=True, help_text='پتاسیم', null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('location', models.ForeignKey(db_column='location_id', help_text='همان location_id در location_data', on_delete=django.db.models.deletion.CASCADE, related_name='sensor_data', to='location_data.soillocation')),
],
options={
'verbose_name': 'داده سنسور',
'verbose_name_plural': 'داده\u200cهای سنسور',
'ordering': ['-updated_at'],
},
),
migrations.CreateModel(
name='ParameterUpdateLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('action', models.CharField(choices=[('added', 'اضافه شده'), ('modified', 'ویرایش شده')], max_length=16)),
('updated_at', models.DateTimeField(auto_now_add=True)),
('parameter', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='update_logs', to='sensor_data.sensorparameter')),
],
options={
'verbose_name': 'لاگ آپدیت پارامتر',
'verbose_name_plural': 'لاگ آپدیت پارامترها',
'ordering': ['-updated_at'],
},
),
]