ttvdrops/twitch/migrations/0005_add_reward_campaign.py

120 lines
5.2 KiB
Python

# Generated by Django 6.0.1 on 2026-01-13 20:31
from __future__ import annotations
import django.db.models.deletion
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
"""Add RewardCampaign model."""
dependencies = [
("twitch", "0004_remove_game_twitch_game_owner_i_398fa9_idx_and_more"),
]
operations = [
migrations.CreateModel(
name="RewardCampaign",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"twitch_id",
models.TextField(editable=False, help_text="The Twitch ID for this reward campaign.", unique=True),
),
("name", models.TextField(help_text="Name of the reward campaign.")),
(
"brand",
models.TextField(blank=True, default="", help_text="Brand associated with the reward campaign."),
),
(
"starts_at",
models.DateTimeField(blank=True, help_text="Datetime when the reward campaign starts.", null=True),
),
(
"ends_at",
models.DateTimeField(blank=True, help_text="Datetime when the reward campaign ends.", null=True),
),
(
"status",
models.TextField(default="UNKNOWN", help_text="Status of the reward campaign.", max_length=50),
),
(
"summary",
models.TextField(blank=True, default="", help_text="Summary description of the reward campaign."),
),
(
"instructions",
models.TextField(blank=True, default="", help_text="Instructions for the reward campaign."),
),
(
"external_url",
models.URLField(
blank=True,
default="",
help_text="External URL for the reward campaign.",
max_length=500,
),
),
(
"reward_value_url_param",
models.TextField(blank=True, default="", help_text="URL parameter for reward value."),
),
(
"about_url",
models.URLField(
blank=True,
default="",
help_text="About URL for the reward campaign.",
max_length=500,
),
),
(
"is_sitewide",
models.BooleanField(default=False, help_text="Whether the reward campaign is sitewide."),
),
(
"added_at",
models.DateTimeField(
auto_now_add=True,
help_text="Timestamp when this reward campaign record was created.",
),
),
(
"updated_at",
models.DateTimeField(
auto_now=True,
help_text="Timestamp when this reward campaign record was last updated.",
),
),
(
"game",
models.ForeignKey(
blank=True,
help_text="Game associated with this reward campaign (if any).",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="reward_campaigns",
to="twitch.game",
),
),
],
options={
"ordering": ["-starts_at"],
"indexes": [
models.Index(fields=["-starts_at"], name="twitch_rewa_starts__4df564_idx"),
models.Index(fields=["ends_at"], name="twitch_rewa_ends_at_354b15_idx"),
models.Index(fields=["twitch_id"], name="twitch_rewa_twitch__797967_idx"),
models.Index(fields=["name"], name="twitch_rewa_name_f1e3dd_idx"),
models.Index(fields=["brand"], name="twitch_rewa_brand_41c321_idx"),
models.Index(fields=["status"], name="twitch_rewa_status_a96d6b_idx"),
models.Index(fields=["is_sitewide"], name="twitch_rewa_is_site_7d2c9f_idx"),
models.Index(fields=["game"], name="twitch_rewa_game_id_678fbb_idx"),
models.Index(fields=["added_at"], name="twitch_rewa_added_a_ae3748_idx"),
models.Index(fields=["updated_at"], name="twitch_rewa_updated_fdf599_idx"),
models.Index(fields=["starts_at", "ends_at"], name="twitch_rewa_starts__dd909d_idx"),
models.Index(fields=["status", "-starts_at"], name="twitch_rewa_status_3641a4_idx"),
],
},
),
]