# Generated by Django 5.1.4 on 2025-02-10 01:10 import django.contrib.auth.models import django.contrib.auth.validators import django.db.models.deletion import django.utils.timezone import pgtrigger.compiler import pgtrigger.migrations from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ("auth", "0012_alter_user_first_name_max_length"), ("contenttypes", "0002_remove_content_type_name"), ("pghistory", "0006_delete_aggregateevent"), ] operations = [ migrations.CreateModel( name="User", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("password", models.CharField(max_length=128, verbose_name="password")), ( "last_login", models.DateTimeField( blank=True, null=True, verbose_name="last login" ), ), ( "is_superuser", models.BooleanField( default=False, help_text="Designates that this user has all permissions without explicitly assigning them.", verbose_name="superuser status", ), ), ( "username", models.CharField( error_messages={ "unique": "A user with that username already exists." }, help_text="Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.", max_length=150, unique=True, validators=[ django.contrib.auth.validators.UnicodeUsernameValidator() ], verbose_name="username", ), ), ( "first_name", models.CharField( blank=True, max_length=150, verbose_name="first name" ), ), ( "last_name", models.CharField( blank=True, max_length=150, verbose_name="last name" ), ), ( "email", models.EmailField( blank=True, max_length=254, verbose_name="email address" ), ), ( "is_staff", models.BooleanField( default=False, help_text="Designates whether the user can log into this admin site.", verbose_name="staff status", ), ), ( "is_active", models.BooleanField( default=True, help_text="Designates whether this user should be treated as active. Unselect this instead of deleting accounts.", verbose_name="active", ), ), ( "date_joined", models.DateTimeField( default=django.utils.timezone.now, verbose_name="date joined" ), ), ( "user_id", models.CharField( editable=False, help_text="Unique identifier for this user that remains constant even if the username changes", max_length=10, unique=True, ), ), ( "role", models.CharField( choices=[ ("USER", "User"), ("MODERATOR", "Moderator"), ("ADMIN", "Admin"), ("SUPERUSER", "Superuser"), ], default="USER", max_length=10, ), ), ("is_banned", models.BooleanField(default=False)), ("ban_reason", models.TextField(blank=True)), ("ban_date", models.DateTimeField(blank=True, null=True)), ( "pending_email", models.EmailField(blank=True, max_length=254, null=True), ), ( "theme_preference", models.CharField( choices=[("light", "Light"), ("dark", "Dark")], default="light", max_length=5, ), ), ( "groups", models.ManyToManyField( blank=True, help_text="The groups this user belongs to. A user will get all permissions granted to each of their groups.", related_name="user_set", related_query_name="user", to="auth.group", verbose_name="groups", ), ), ( "user_permissions", models.ManyToManyField( blank=True, help_text="Specific permissions for this user.", related_name="user_set", related_query_name="user", to="auth.permission", verbose_name="user permissions", ), ), ], options={ "verbose_name": "user", "verbose_name_plural": "users", "abstract": False, }, managers=[ ("objects", django.contrib.auth.models.UserManager()), ], ), migrations.CreateModel( name="EmailVerification", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("token", models.CharField(max_length=64, unique=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("last_sent", models.DateTimeField(auto_now_add=True)), ( "user", models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, ), ), ], options={ "verbose_name": "Email Verification", "verbose_name_plural": "Email Verifications", }, ), migrations.CreateModel( name="PasswordReset", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("token", models.CharField(max_length=64)), ("created_at", models.DateTimeField(auto_now_add=True)), ("expires_at", models.DateTimeField()), ("used", models.BooleanField(default=False)), ( "user", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, ), ), ], options={ "verbose_name": "Password Reset", "verbose_name_plural": "Password Resets", }, ), migrations.CreateModel( name="TopList", fields=[ ("id", models.BigAutoField(primary_key=True, serialize=False)), ("title", models.CharField(max_length=100)), ( "category", models.CharField( choices=[ ("RC", "Roller Coaster"), ("DR", "Dark Ride"), ("FR", "Flat Ride"), ("WR", "Water Ride"), ("PK", "Park"), ], max_length=2, ), ), ("description", models.TextField(blank=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ( "user", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="top_lists", to=settings.AUTH_USER_MODEL, ), ), ], options={ "ordering": ["-updated_at"], }, ), migrations.CreateModel( name="TopListEvent", fields=[ ("pgh_id", models.AutoField(primary_key=True, serialize=False)), ("pgh_created_at", models.DateTimeField(auto_now_add=True)), ("pgh_label", models.TextField(help_text="The event label.")), ("id", models.BigIntegerField()), ("title", models.CharField(max_length=100)), ( "category", models.CharField( choices=[ ("RC", "Roller Coaster"), ("DR", "Dark Ride"), ("FR", "Flat Ride"), ("WR", "Water Ride"), ("PK", "Park"), ], max_length=2, ), ), ("description", models.TextField(blank=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("updated_at", models.DateTimeField(auto_now=True)), ( "pgh_context", models.ForeignKey( db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", to="pghistory.context", ), ), ( "pgh_obj", models.ForeignKey( db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name="events", to="accounts.toplist", ), ), ( "user", models.ForeignKey( db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", related_query_name="+", to=settings.AUTH_USER_MODEL, ), ), ], options={ "abstract": False, }, ), migrations.CreateModel( name="TopListItem", fields=[ ("id", models.BigAutoField(primary_key=True, serialize=False)), ("object_id", models.PositiveIntegerField()), ("rank", models.PositiveIntegerField()), ("notes", models.TextField(blank=True)), ( "content_type", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, to="contenttypes.contenttype", ), ), ( "top_list", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="items", to="accounts.toplist", ), ), ], options={ "ordering": ["rank"], }, ), migrations.CreateModel( name="TopListItemEvent", fields=[ ("pgh_id", models.AutoField(primary_key=True, serialize=False)), ("pgh_created_at", models.DateTimeField(auto_now_add=True)), ("pgh_label", models.TextField(help_text="The event label.")), ("id", models.BigIntegerField()), ("object_id", models.PositiveIntegerField()), ("rank", models.PositiveIntegerField()), ("notes", models.TextField(blank=True)), ( "content_type", models.ForeignKey( db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", related_query_name="+", to="contenttypes.contenttype", ), ), ( "pgh_context", models.ForeignKey( db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", to="pghistory.context", ), ), ( "pgh_obj", models.ForeignKey( db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name="events", to="accounts.toplistitem", ), ), ( "top_list", models.ForeignKey( db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name="+", related_query_name="+", to="accounts.toplist", ), ), ], options={ "abstract": False, }, ), migrations.CreateModel( name="UserProfile", fields=[ ( "id", models.BigAutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ( "profile_id", models.CharField( editable=False, help_text="Unique identifier for this profile that remains constant", max_length=10, unique=True, ), ), ( "display_name", models.CharField( help_text="This is the name that will be displayed on the site", max_length=50, unique=True, ), ), ("avatar", models.ImageField(blank=True, upload_to="avatars/")), ("pronouns", models.CharField(blank=True, max_length=50)), ("bio", models.TextField(blank=True, max_length=500)), ("twitter", models.URLField(blank=True)), ("instagram", models.URLField(blank=True)), ("youtube", models.URLField(blank=True)), ("discord", models.CharField(blank=True, max_length=100)), ("coaster_credits", models.IntegerField(default=0)), ("dark_ride_credits", models.IntegerField(default=0)), ("flat_ride_credits", models.IntegerField(default=0)), ("water_ride_credits", models.IntegerField(default=0)), ( "user", models.OneToOneField( on_delete=django.db.models.deletion.CASCADE, related_name="profile", to=settings.AUTH_USER_MODEL, ), ), ], ), pgtrigger.migrations.AddTrigger( model_name="toplist", trigger=pgtrigger.compiler.Trigger( name="insert_insert", sql=pgtrigger.compiler.UpsertTriggerSql( func='INSERT INTO "accounts_toplistevent" ("category", "created_at", "description", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "title", "updated_at", "user_id") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."title", NEW."updated_at", NEW."user_id"); RETURN NULL;', hash="[AWS-SECRET-REMOVED]", operation="INSERT", pgid="pgtrigger_insert_insert_26546", table="accounts_toplist", when="AFTER", ), ), ), pgtrigger.migrations.AddTrigger( model_name="toplist", trigger=pgtrigger.compiler.Trigger( name="update_update", sql=pgtrigger.compiler.UpsertTriggerSql( condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)", func='INSERT INTO "accounts_toplistevent" ("category", "created_at", "description", "id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "title", "updated_at", "user_id") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."title", NEW."updated_at", NEW."user_id"); RETURN NULL;', hash="[AWS-SECRET-REMOVED]", operation="UPDATE", pgid="pgtrigger_update_update_84849", table="accounts_toplist", when="AFTER", ), ), ), migrations.AlterUniqueTogether( name="toplistitem", unique_together={("top_list", "rank")}, ), pgtrigger.migrations.AddTrigger( model_name="toplistitem", trigger=pgtrigger.compiler.Trigger( name="insert_insert", sql=pgtrigger.compiler.UpsertTriggerSql( func='INSERT INTO "accounts_toplistitemevent" ("content_type_id", "id", "notes", "object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rank", "top_list_id") VALUES (NEW."content_type_id", NEW."id", NEW."notes", NEW."object_id", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."rank", NEW."top_list_id"); RETURN NULL;', hash="[AWS-SECRET-REMOVED]", operation="INSERT", pgid="pgtrigger_insert_insert_56dfc", table="accounts_toplistitem", when="AFTER", ), ), ), pgtrigger.migrations.AddTrigger( model_name="toplistitem", trigger=pgtrigger.compiler.Trigger( name="update_update", sql=pgtrigger.compiler.UpsertTriggerSql( condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)", func='INSERT INTO "accounts_toplistitemevent" ("content_type_id", "id", "notes", "object_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "rank", "top_list_id") VALUES (NEW."content_type_id", NEW."id", NEW."notes", NEW."object_id", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."rank", NEW."top_list_id"); RETURN NULL;', hash="[AWS-SECRET-REMOVED]", operation="UPDATE", pgid="pgtrigger_update_update_2b6e3", table="accounts_toplistitem", when="AFTER", ), ), ), ]