# Generated by Django 5.1.4 on 2024-12-11 04:58 from __future__ import annotations from typing import TYPE_CHECKING import auto_prefetch import django.contrib.auth.models import django.contrib.auth.validators import django.db.models.deletion import django.db.models.manager import django.utils.timezone from django.db import migrations, models if TYPE_CHECKING: from django.db.migrations.operations.base import Operation class Migration(migrations.Migration): """Initial migration for the core app. This add the following models: - ScrapedJson - User - Owner - Game - DropCampaign - TimeBasedDrop - Benefit """ initial = True dependencies: list[tuple[str, str]] = [ ("auth", "0012_alter_user_first_name_max_length"), ] operations: list[Operation] = [ migrations.CreateModel( name="ScrapedJson", fields=[ ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), ("json_data", models.JSONField(help_text="The JSON data from the Twitch API.", unique=True)), ("created_at", models.DateTimeField(auto_now_add=True)), ("modified_at", models.DateTimeField(auto_now=True)), ("imported_at", models.DateTimeField(null=True)), ], options={ "ordering": ["-created_at"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), 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")), ( "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={ "ordering": ["username"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.contrib.auth.models.UserManager()), ], ), migrations.CreateModel( name="Owner", fields=[ ("created_at", models.DateTimeField(auto_created=True)), ( "twitch_id", models.TextField(help_text="The Twitch ID of the owner.", primary_key=True, serialize=False), ), ("modified_at", models.DateTimeField(auto_now=True)), ("name", models.TextField(blank=True, help_text="The name of the owner.")), ], options={ "ordering": ["name"], "abstract": False, "base_manager_name": "prefetch_manager", "indexes": [ models.Index(fields=["name"], name="owner_name_idx"), models.Index(fields=["created_at"], name="owner_created_at_idx"), ], }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), migrations.CreateModel( name="Game", fields=[ ( "created_at", models.DateTimeField(auto_created=True, help_text="When the game was first added to the database."), ), ( "twitch_id", models.TextField(help_text="The Twitch ID of the game.", primary_key=True, serialize=False), ), ("modified_at", models.DateTimeField(auto_now=True, help_text="When the game was last modified.")), ("game_url", models.URLField(blank=True, help_text="The URL to the game on Twitch.")), ("display_name", models.TextField(blank=True, help_text="The display name of the game.")), ("name", models.TextField(blank=True, help_text="The name of the game.")), ("box_art_url", models.URLField(blank=True, help_text="URL to the box art of the game.")), ("slug", models.TextField(blank=True)), ( "org", auto_prefetch.ForeignKey( null=True, on_delete=django.db.models.deletion.CASCADE, related_name="games", to="core.owner", ), ), ], options={ "ordering": ["display_name"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), migrations.CreateModel( name="DropCampaign", fields=[ ( "created_at", models.DateTimeField( auto_created=True, help_text="When the drop campaign was first added to the database.", ), ), ( "twitch_id", models.TextField( help_text="The Twitch ID of the drop campaign.", primary_key=True, serialize=False, ), ), ( "modified_at", models.DateTimeField(auto_now=True, help_text="When the drop campaign was last modified."), ), ( "account_link_url", models.URLField(blank=True, help_text="The URL to link accounts for the drop campaign."), ), ("description", models.TextField(blank=True, help_text="The description of the drop campaign.")), ("details_url", models.URLField(blank=True, help_text="The URL to the details of the drop campaign.")), ("ends_at", models.DateTimeField(help_text="When the drop campaign ends.", null=True)), ("starts_at", models.DateTimeField(help_text="When the drop campaign starts.", null=True)), ("image_url", models.URLField(blank=True, help_text="The URL to the image for the drop campaign.")), ("name", models.TextField(blank=True, help_text="The name of the drop campaign.")), ("status", models.TextField(blank=True, help_text="The status of the drop campaign.")), ( "game", auto_prefetch.ForeignKey( null=True, on_delete=django.db.models.deletion.CASCADE, related_name="drop_campaigns", to="core.game", ), ), ( "scraped_json", auto_prefetch.ForeignKey( help_text="Reference to the JSON data from the Twitch API.", null=True, on_delete=django.db.models.deletion.SET_NULL, to="core.scrapedjson", ), ), ], options={ "ordering": ["ends_at"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), migrations.CreateModel( name="TimeBasedDrop", fields=[ ( "created_at", models.DateTimeField(auto_created=True, help_text="When the drop was first added to the database."), ), ( "twitch_id", models.TextField(help_text="The Twitch ID of the drop.", primary_key=True, serialize=False), ), ("modified_at", models.DateTimeField(auto_now=True, help_text="When the drop was last modified.")), ( "required_subs", models.PositiveBigIntegerField(help_text="The number of subs required for the drop.", null=True), ), ("ends_at", models.DateTimeField(help_text="When the drop ends.", null=True)), ("name", models.TextField(blank=True, help_text="The name of the drop.")), ( "required_minutes_watched", models.PositiveBigIntegerField(help_text="The number of minutes watched required.", null=True), ), ("starts_at", models.DateTimeField(help_text="When the drop starts.", null=True)), ( "drop_campaign", auto_prefetch.ForeignKey( help_text="The drop campaign this drop is part of.", null=True, on_delete=django.db.models.deletion.CASCADE, related_name="drops", to="core.dropcampaign", ), ), ], options={ "ordering": ["required_minutes_watched"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), migrations.CreateModel( name="Benefit", fields=[ ("created_at", models.DateTimeField(auto_created=True, null=True)), ("twitch_id", models.TextField(primary_key=True, serialize=False)), ("modified_at", models.DateTimeField(auto_now=True)), ( "twitch_created_at", models.DateTimeField(help_text="When the benefit was created on Twitch.", null=True), ), ( "entitlement_limit", models.PositiveBigIntegerField( help_text="The number of times the benefit can be claimed.", null=True, ), ), ("image_asset_url", models.URLField(blank=True, help_text="The URL to the image for the benefit.")), ("is_ios_available", models.BooleanField(help_text="If the benefit is farmable on iOS.", null=True)), ("name", models.TextField(blank=True, help_text="The name of the benefit.")), ("distribution_type", models.TextField(blank=True, help_text="The distribution type of the benefit.")), ( "game", auto_prefetch.ForeignKey( null=True, on_delete=django.db.models.deletion.CASCADE, related_name="benefits", to="core.game", ), ), ( "owner_organization", auto_prefetch.ForeignKey( null=True, on_delete=django.db.models.deletion.CASCADE, related_name="benefits", to="core.owner", ), ), ( "time_based_drop", auto_prefetch.ForeignKey( help_text="The time based drop this benefit is for.", null=True, on_delete=django.db.models.deletion.CASCADE, related_name="benefits", to="core.timebaseddrop", ), ), ], options={ "ordering": ["-twitch_created_at"], "abstract": False, "base_manager_name": "prefetch_manager", }, managers=[ ("objects", django.db.models.manager.Manager()), ("prefetch_manager", django.db.models.manager.Manager()), ], ), migrations.AddIndex( model_name="game", index=models.Index(fields=["display_name"], name="game_display_name_idx"), ), migrations.AddIndex( model_name="game", index=models.Index(fields=["name"], name="game_name_idx"), ), migrations.AddIndex( model_name="game", index=models.Index(fields=["created_at"], name="game_created_at_idx"), ), migrations.AddIndex( model_name="dropcampaign", index=models.Index(fields=["name"], name="drop_campaign_name_idx"), ), migrations.AddIndex( model_name="dropcampaign", index=models.Index(fields=["starts_at"], name="drop_campaign_starts_at_idx"), ), migrations.AddIndex( model_name="dropcampaign", index=models.Index(fields=["ends_at"], name="drop_campaign_ends_at_idx"), ), migrations.AddIndex( model_name="timebaseddrop", index=models.Index(fields=["name"], name="time_based_drop_name_idx"), ), migrations.AddIndex( model_name="timebaseddrop", index=models.Index(fields=["starts_at"], name="time_based_drop_starts_at_idx"), ), migrations.AddIndex( model_name="timebaseddrop", index=models.Index(fields=["ends_at"], name="time_based_drop_ends_at_idx"), ), migrations.AddIndex( model_name="benefit", index=models.Index(fields=["name"], name="benefit_name_idx"), ), migrations.AddIndex( model_name="benefit", index=models.Index(fields=["twitch_created_at"], name="benefit_twitch_created_at_idx"), ), migrations.AddIndex( model_name="benefit", index=models.Index(fields=["created_at"], name="benefit_created_at_idx"), ), migrations.AddIndex( model_name="benefit", index=models.Index(fields=["is_ios_available"], name="benefit_is_ios_available_idx"), ), ]