import uuid from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("location_data", "0016_remove_analysisgridobservation_lst_c"), ] operations = [ migrations.CreateModel( name="RemoteSensingClusterBlock", fields=[ ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ("uuid", models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)), ("block_code", models.CharField(blank=True, db_index=True, default="", help_text="شناسه بلوک والد که این زیر‌بلاک KMeans داخل آن ساخته شده است.", max_length=64)), ("sub_block_code", models.CharField(db_index=True, help_text="شناسه زیر‌بلاک ساخته‌شده توسط KMeans مثل cluster-0.", max_length=64)), ("cluster_label", models.PositiveIntegerField(db_index=True)), ("chunk_size_sqm", models.PositiveIntegerField(default=900)), ("centroid_lat", models.DecimalField(db_index=True, decimal_places=6, help_text="عرض جغرافیایی مرکز زیر‌بلاک.", max_digits=9)), ("centroid_lon", models.DecimalField(db_index=True, decimal_places=6, help_text="طول جغرافیایی مرکز زیر‌بلاک.", max_digits=9)), ("geometry", models.JSONField(blank=True, default=dict, help_text="هندسه GeoJSON زیر‌بلاک KMeans. فعلا از چندضلعی/چندچندضلعی سلول‌های عضو ساخته می‌شود.")), ("cell_count", models.PositiveIntegerField(default=0)), ("cell_codes", models.JSONField(blank=True, default=list)), ("metadata", models.JSONField(blank=True, default=dict)), ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)), ("updated_at", models.DateTimeField(auto_now=True)), ("block_subdivision", models.ForeignKey(blank=True, null=True, on_delete=models.deletion.SET_NULL, related_name="remote_sensing_cluster_blocks", to="location_data.blocksubdivision")), ("result", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="cluster_blocks", to="location_data.remotesensingsubdivisionresult")), ("soil_location", models.ForeignKey(on_delete=models.deletion.CASCADE, related_name="remote_sensing_cluster_blocks", to="location_data.soillocation")), ], options={ "verbose_name": "remote sensing cluster block", "verbose_name_plural": "remote sensing cluster blocks", "ordering": ["result", "cluster_label", "id"], }, ), migrations.AddConstraint( model_name="remotesensingclusterblock", constraint=models.UniqueConstraint(fields=("result", "cluster_label"), name="rs_cluster_block_unique_result_label"), ), migrations.AddIndex( model_name="remotesensingclusterblock", index=models.Index(fields=["soil_location", "block_code", "cluster_label"], name="rs_cluster_block_lookup_idx"), ), ]