# Generated by Django 5.1.3 on 2024-11-12 18:07 import django.contrib.gis.db.models.fields import django.core.validators import django.db.models.deletion import simple_history.models from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ("contenttypes", "0002_remove_content_type_name"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name="HistoricalLocation", fields=[ ( "id", models.BigIntegerField( auto_created=True, blank=True, db_index=True, verbose_name="ID" ), ), ("object_id", models.PositiveIntegerField()), ( "name", models.CharField( help_text="Name of the location (e.g. business name, landmark)", max_length=255, ), ), ( "location_type", models.CharField( help_text="Type of location (e.g. business, landmark, address)", max_length=50, ), ), ( "latitude", models.DecimalField( blank=True, decimal_places=6, help_text="Latitude coordinate (legacy field)", max_digits=9, null=True, validators=[ django.core.validators.MinValueValidator(-90), django.core.validators.MaxValueValidator(90), ], ), ), ( "longitude", models.DecimalField( blank=True, decimal_places=6, help_text="Longitude coordinate (legacy field)", max_digits=9, null=True, validators=[ django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180), ], ), ), ( "point", django.contrib.gis.db.models.fields.PointField( blank=True, help_text="Geographic coordinates as a Point", null=True, srid=4326, ), ), ( "street_address", models.CharField(blank=True, max_length=255, null=True), ), ("city", models.CharField(blank=True, max_length=100, null=True)), ( "state", models.CharField( blank=True, help_text="State/Region/Province", max_length=100, null=True, ), ), ("country", models.CharField(blank=True, max_length=100, null=True)), ("postal_code", models.CharField(blank=True, max_length=20, null=True)), ("created_at", models.DateTimeField(blank=True, editable=False)), ("updated_at", models.DateTimeField(blank=True, editable=False)), ("history_id", models.AutoField(primary_key=True, serialize=False)), ("history_date", models.DateTimeField(db_index=True)), ("history_change_reason", models.CharField(max_length=100, null=True)), ( "history_type", models.CharField( choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")], max_length=1, ), ), ( "content_type", models.ForeignKey( blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", to="contenttypes.contenttype", ), ), ( "history_user", models.ForeignKey( null=True, on_delete=django.db.models.deletion.SET_NULL, related_name="+", to=settings.AUTH_USER_MODEL, ), ), ], options={ "verbose_name": "historical location", "verbose_name_plural": "historical locations", "ordering": ("-history_date", "-history_id"), "get_latest_by": ("history_date", "history_id"), }, bases=(simple_history.models.HistoricalChanges, models.Model), ), migrations.CreateModel( name="Location", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("object_id", models.PositiveIntegerField()), ( "name", models.CharField( help_text="Name of the location (e.g. business name, landmark)", max_length=255, ), ), ( "location_type", models.CharField( help_text="Type of location (e.g. business, landmark, address)", max_length=50, ), ), ( "latitude", models.DecimalField( blank=True, decimal_places=6, help_text="Latitude coordinate (legacy field)", max_digits=9, null=True, validators=[ django.core.validators.MinValueValidator(-90), django.core.validators.MaxValueValidator(90), ], ), ), ( "longitude", models.DecimalField( blank=True, decimal_places=6, help_text="Longitude coordinate (legacy field)", max_digits=9, null=True, validators=[ django.core.validators.MinValueValidator(-180), django.core.validators.MaxValueValidator(180), ], ), ), ( "point", django.contrib.gis.db.models.fields.PointField( blank=True, help_text="Geographic coordinates as a Point", null=True, srid=4326, ), ), ( "street_address", models.CharField(blank=True, max_length=255, null=True), ), ("city", models.CharField(blank=True, max_length=100, null=True)), ( "state", models.CharField( blank=True, help_text="State/Region/Province", max_length=100, null=True, ), ), ("country", models.CharField(blank=True, max_length=100, null=True)), ("postal_code", models.CharField(blank=True, max_length=20, null=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ( "content_type", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype", ), ), ], options={ "ordering": ["name"], "indexes": [ models.Index( fields=["content_type", "object_id"], name="location_lo_content_9ee1bd_idx", ), models.Index(fields=["city"], name="location_lo_city_99f908_idx"), models.Index( fields=["country"], name="location_lo_country_b75eba_idx" ), ], }, ), ]