- Deleted all test files in accounts and twitch apps to clean up the codebase. - Updated the DropCampaign, Game, Organization, DropBenefit, TimeBasedDrop, and DropBenefitEdge models to include database indexing for improved query performance. - Modified the DropCampaignListView and GameDetailView to remove unnecessary status filtering and streamline campaign retrieval logic. - Enhanced the campaign detail template to properly format campaign descriptions. - Adjusted the import_drop_campaign management command to increase default worker and batch sizes for improved performance. - Cleaned up the admin configuration for DropCampaign and TimeBasedDrop models.
162 lines
7.4 KiB
Python
162 lines
7.4 KiB
Python
# Generated by Django 5.2.4 on 2025-07-23 23:51
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='DropBenefit',
|
|
fields=[
|
|
('id', models.TextField(primary_key=True, serialize=False)),
|
|
('name', models.TextField(db_index=True)),
|
|
('image_asset_url', models.URLField(blank=True, default='', max_length=500)),
|
|
('created_at', models.DateTimeField(db_index=True)),
|
|
('entitlement_limit', models.PositiveIntegerField(default=1)),
|
|
('is_ios_available', models.BooleanField(default=False)),
|
|
('distribution_type', models.TextField(choices=[('DIRECT_ENTITLEMENT', 'Direct Entitlement'), ('CODE', 'Code')], db_index=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='DropBenefitEdge',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('entitlement_limit', models.PositiveIntegerField(default=1)),
|
|
('benefit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='twitch.dropbenefit')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Game',
|
|
fields=[
|
|
('id', models.TextField(primary_key=True, serialize=False)),
|
|
('slug', models.TextField(blank=True, db_index=True, default='')),
|
|
('display_name', models.TextField(db_index=True)),
|
|
],
|
|
options={
|
|
'indexes': [models.Index(fields=['slug'], name='twitch_game_slug_a02d3c_idx'), models.Index(fields=['display_name'], name='twitch_game_display_a35ba3_idx')],
|
|
},
|
|
),
|
|
migrations.AddField(
|
|
model_name='dropbenefit',
|
|
name='game',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='drop_benefits', to='twitch.game'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='Organization',
|
|
fields=[
|
|
('id', models.TextField(primary_key=True, serialize=False)),
|
|
('name', models.TextField(db_index=True)),
|
|
],
|
|
options={
|
|
'indexes': [models.Index(fields=['name'], name='twitch_orga_name_febe72_idx')],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='DropCampaign',
|
|
fields=[
|
|
('id', models.TextField(primary_key=True, serialize=False)),
|
|
('name', models.TextField(db_index=True)),
|
|
('description', models.TextField(blank=True)),
|
|
('details_url', models.URLField(blank=True, default='', max_length=500)),
|
|
('account_link_url', models.URLField(blank=True, default='', max_length=500)),
|
|
('image_url', models.URLField(blank=True, default='', max_length=500)),
|
|
('start_at', models.DateTimeField(db_index=True)),
|
|
('end_at', models.DateTimeField(db_index=True)),
|
|
('is_account_connected', models.BooleanField(default=False)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='drop_campaigns', to='twitch.game')),
|
|
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='drop_campaigns', to='twitch.organization')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='dropbenefit',
|
|
name='owner_organization',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='drop_benefits', to='twitch.organization'),
|
|
),
|
|
migrations.CreateModel(
|
|
name='TimeBasedDrop',
|
|
fields=[
|
|
('id', models.TextField(primary_key=True, serialize=False)),
|
|
('name', models.TextField(db_index=True)),
|
|
('required_minutes_watched', models.PositiveIntegerField(db_index=True)),
|
|
('required_subs', models.PositiveIntegerField(default=0)),
|
|
('start_at', models.DateTimeField(db_index=True)),
|
|
('end_at', models.DateTimeField(db_index=True)),
|
|
('benefits', models.ManyToManyField(related_name='drops', through='twitch.DropBenefitEdge', to='twitch.dropbenefit')),
|
|
('campaign', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='time_based_drops', to='twitch.dropcampaign')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='dropbenefitedge',
|
|
name='drop',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='twitch.timebaseddrop'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropcampaign',
|
|
index=models.Index(fields=['name'], name='twitch_drop_name_3b70b3_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropcampaign',
|
|
index=models.Index(fields=['start_at', 'end_at'], name='twitch_drop_start_a_6e5fb6_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropcampaign',
|
|
index=models.Index(fields=['game'], name='twitch_drop_game_id_868e70_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropcampaign',
|
|
index=models.Index(fields=['owner'], name='twitch_drop_owner_i_37241d_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefit',
|
|
index=models.Index(fields=['name'], name='twitch_drop_name_7125ff_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefit',
|
|
index=models.Index(fields=['created_at'], name='twitch_drop_created_a3563e_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefit',
|
|
index=models.Index(fields=['distribution_type'], name='twitch_drop_distrib_08b224_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefit',
|
|
index=models.Index(fields=['game'], name='twitch_drop_game_id_a9209e_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefit',
|
|
index=models.Index(fields=['owner_organization'], name='twitch_drop_owner_o_45b4cc_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='timebaseddrop',
|
|
index=models.Index(fields=['name'], name='twitch_time_name_47c0f4_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='timebaseddrop',
|
|
index=models.Index(fields=['start_at', 'end_at'], name='twitch_time_start_a_c481f1_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='timebaseddrop',
|
|
index=models.Index(fields=['campaign'], name='twitch_time_campaig_bbe349_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='timebaseddrop',
|
|
index=models.Index(fields=['required_minutes_watched'], name='twitch_time_require_82c30c_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='dropbenefitedge',
|
|
index=models.Index(fields=['drop', 'benefit'], name='twitch_drop_drop_id_5a574c_idx'),
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='dropbenefitedge',
|
|
unique_together={('drop', 'benefit')},
|
|
),
|
|
]
|