phase3: add normalized domain schema, admin, services, and multistage docker build
This commit is contained in:
113
apps/players/migrations/0001_initial.py
Normal file
113
apps/players/migrations/0001_initial.py
Normal file
@ -0,0 +1,113 @@
|
||||
# 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'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Position',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('code', models.CharField(max_length=10, unique=True)),
|
||||
('name', models.CharField(max_length=80, unique=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['code'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Role',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('code', models.CharField(max_length=32, unique=True)),
|
||||
('name', models.CharField(max_length=120, unique=True)),
|
||||
('description', models.TextField(blank=True)),
|
||||
],
|
||||
options={
|
||||
'ordering': ['name'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Nationality',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('name', models.CharField(max_length=120, unique=True)),
|
||||
('iso2_code', models.CharField(max_length=2, unique=True)),
|
||||
('iso3_code', models.CharField(blank=True, max_length=3, null=True, unique=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name_plural': 'Nationalities',
|
||||
'ordering': ['name'],
|
||||
'indexes': [models.Index(fields=['name'], name='players_nat_name_8688fe_idx'), models.Index(fields=['iso2_code'], name='players_nat_iso2_co_57069a_idx')],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Player',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('first_name', models.CharField(max_length=120)),
|
||||
('last_name', models.CharField(max_length=120)),
|
||||
('full_name', models.CharField(max_length=260)),
|
||||
('birth_date', models.DateField(blank=True, null=True)),
|
||||
('height_cm', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('weight_kg', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('wingspan_cm', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('dominant_hand', models.CharField(choices=[('right', 'Right'), ('left', 'Left'), ('both', 'Both'), ('unknown', 'Unknown')], default='unknown', max_length=16)),
|
||||
('is_active', models.BooleanField(default=True)),
|
||||
('nationality', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='players', to='players.nationality')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['full_name', 'id'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PlayerAlias',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('alias', models.CharField(max_length=260)),
|
||||
('source', models.CharField(blank=True, max_length=80)),
|
||||
('is_primary', models.BooleanField(default=False)),
|
||||
('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='aliases', to='players.player')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['alias'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='PlayerCareerEntry',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_at', models.DateTimeField(auto_now=True)),
|
||||
('shirt_number', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('start_date', models.DateField(blank=True, null=True)),
|
||||
('end_date', models.DateField(blank=True, null=True)),
|
||||
('notes', models.TextField(blank=True)),
|
||||
('competition', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='career_entries', to='competitions.competition')),
|
||||
('player', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='career_entries', to='players.player')),
|
||||
('season', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='career_entries', to='competitions.season')),
|
||||
],
|
||||
options={
|
||||
'ordering': ['player', '-start_date', '-id'],
|
||||
},
|
||||
),
|
||||
]
|
||||
121
apps/players/migrations/0002_initial.py
Normal file
121
apps/players/migrations/0002_initial.py
Normal file
@ -0,0 +1,121 @@
|
||||
# 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 = [
|
||||
('players', '0001_initial'),
|
||||
('teams', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='playercareerentry',
|
||||
name='team',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='career_entries', to='teams.team'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='position',
|
||||
index=models.Index(fields=['code'], name='players_pos_code_ae7cc3_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='position',
|
||||
index=models.Index(fields=['name'], name='players_pos_name_0b1fd3_idx'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='player',
|
||||
name='nominal_position',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nominal_players', to='players.position'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='role',
|
||||
index=models.Index(fields=['code'], name='players_rol_code_51dc71_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='role',
|
||||
index=models.Index(fields=['name'], name='players_rol_name_bef503_idx'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='playercareerentry',
|
||||
name='role_snapshot',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='career_entries', to='players.role'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='player',
|
||||
name='inferred_role',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='role_players', to='players.role'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playeralias',
|
||||
index=models.Index(fields=['alias'], name='players_pla_alias_c2e58f_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playeralias',
|
||||
index=models.Index(fields=['source'], name='players_pla_source_dd2e52_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='playeralias',
|
||||
constraint=models.UniqueConstraint(fields=('player', 'alias'), name='uq_player_alias_per_player'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playercareerentry',
|
||||
index=models.Index(fields=['player', 'start_date'], name='players_pla_player__80e21f_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playercareerentry',
|
||||
index=models.Index(fields=['team', 'season'], name='players_pla_team_id_200f70_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='playercareerentry',
|
||||
index=models.Index(fields=['competition', 'season'], name='players_pla_competi_10cd9d_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='playercareerentry',
|
||||
constraint=models.UniqueConstraint(fields=('player', 'team', 'competition', 'season', 'start_date'), name='uq_player_career_entry_scope'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='playercareerentry',
|
||||
constraint=models.CheckConstraint(condition=models.Q(('end_date__isnull', True), ('start_date__isnull', True), ('end_date__gte', models.F('start_date')), _connector='OR'), name='ck_career_entry_dates'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['full_name'], name='players_pla_full_na_c03349_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['last_name', 'first_name'], name='players_pla_last_na_1786cf_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['birth_date'], name='players_pla_birth_d_354cf8_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['nationality'], name='players_pla_nationa_2ab246_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['nominal_position'], name='players_pla_nominal_ff9fb6_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['inferred_role'], name='players_pla_inferre_136050_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['is_active'], name='players_pla_is_acti_90e805_idx'),
|
||||
),
|
||||
migrations.AddIndex(
|
||||
model_name='player',
|
||||
index=models.Index(fields=['height_cm'], name='players_pla_height__c4ae99_idx'),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='player',
|
||||
constraint=models.UniqueConstraint(fields=('full_name', 'birth_date'), name='uq_player_full_name_birth_date'),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user