Files
hoopscout/apps/players/migrations/0001_initial.py

114 lines
5.8 KiB
Python

# 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'],
},
),
]