phase3: add normalized domain schema, admin, services, and multistage docker build
This commit is contained in:
58
apps/competitions/migrations/0001_initial.py
Normal file
58
apps/competitions/migrations/0001_initial.py
Normal file
@ -0,0 +1,58 @@
|
||||
# Generated by Django 5.2.12 on 2026-03-10 09:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Competition',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=220)),
|
||||
('slug', models.SlugField(max_length=240, unique=True)),
|
||||
('competition_type', models.CharField(choices=[('league', 'League'), ('cup', 'Cup'), ('international', 'International')], max_length=24)),
|
||||
('gender', models.CharField(choices=[('men', 'Men'), ('women', 'Women'), ('mixed', 'Mixed')], default='men', max_length=16)),
|
||||
('level', models.PositiveSmallIntegerField(default=1)),
|
||||
('is_active', models.BooleanField(default=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Season',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('label', models.CharField(max_length=40, unique=True)),
|
||||
('start_date', models.DateField()),
|
||||
('end_date', models.DateField()),
|
||||
('is_current', models.BooleanField(default=False)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['-start_date'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='TeamSeason',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('standing', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('wins', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('losses', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('points', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('coach_name', models.CharField(blank=True, max_length=140)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['competition', 'season', 'team'],
|
||||
},
|
||||
),
|
||||
]
|
||||
94
apps/competitions/migrations/0002_initial.py
Normal file
94
apps/competitions/migrations/0002_initial.py
Normal file
@ -0,0 +1,94 @@
|
||||
# Generated by Django 5.2.12 on 2026-03-10 09:33
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('competitions', '0001_initial'),
|
||||
('players', '0001_initial'),
|
||||
('teams', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='competition',
|
||||
name='country',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='competitions', to='players.nationality'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='season',
|
||||
index=models.Index(fields=['is_current'], name='competition_is_curr_787938_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='season',
|
||||
index=models.Index(fields=['start_date'], name='competition_start_d_08fb82_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='season',
|
||||
index=models.Index(fields=['end_date'], name='competition_end_dat_4ed2e7_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='season',
|
||||
constraint=models.CheckConstraint(condition=models.Q(('end_date__gte', models.F('start_date'))), name='ck_season_dates'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='teamseason',
|
||||
name='competition',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_seasons', to='competitions.competition'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='teamseason',
|
||||
name='season',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_seasons', to='competitions.season'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='teamseason',
|
||||
name='team',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='team_seasons', to='teams.team'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='competition',
|
||||
index=models.Index(fields=['name'], name='competition_name_57eea2_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='competition',
|
||||
index=models.Index(fields=['country'], name='competition_country_93a128_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='competition',
|
||||
index=models.Index(fields=['competition_type'], name='competition_competi_7f1bff_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='competition',
|
||||
index=models.Index(fields=['gender'], name='competition_gender_e21a65_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='competition',
|
||||
index=models.Index(fields=['is_active'], name='competition_is_acti_53f00f_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='competition',
|
||||
constraint=models.UniqueConstraint(fields=('name', 'country'), name='uq_competition_name_country'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='teamseason',
|
||||
index=models.Index(fields=['team', 'season'], name='competition_team_id_c656bd_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='teamseason',
|
||||
index=models.Index(fields=['season', 'competition'], name='competition_season__9f17b6_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='teamseason',
|
||||
index=models.Index(fields=['competition', 'standing'], name='competition_competi_e1c8c7_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='teamseason',
|
||||
constraint=models.UniqueConstraint(fields=('team', 'season', 'competition'), name='uq_team_season_competition'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user