2026-02-27 13:31:16 +03:30
# 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 = [
2026-03-19 22:54:29 +03:30
( ' location_data ' , ' 0002_soildepthdata_refactor ' ) ,
2026-02-27 13:31:16 +03:30
]
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 = ' شناسه سنسور ' ) ) ,
2026-03-19 22:54:29 +03:30
( ' location_id ' , models . IntegerField ( help_text = ' location_id از location_data ' ) ) ,
2026-02-27 13:31:16 +03:30
( ' 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 ) ) ,
2026-03-19 22:54:29 +03:30
( ' 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 ' ) ) ,
2026-02-27 13:31:16 +03:30
] ,
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 ' ] ,
} ,
) ,
]