generated from bisco/codex-bootstrap
99 lines
4.3 KiB
Python
99 lines
4.3 KiB
Python
# Generated by Django 5.2.3 on 2026-04-28
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
from django.db.models import F, Q
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = []
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Show",
|
|
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)),
|
|
("title", models.CharField(max_length=200)),
|
|
("slug", models.SlugField(max_length=220, unique=True)),
|
|
("summary", models.TextField(blank=True)),
|
|
("description", models.TextField(blank=True)),
|
|
("poster_image", models.URLField(blank=True)),
|
|
("is_published", models.BooleanField(db_index=True, default=False)),
|
|
],
|
|
options={
|
|
"ordering": ["title"],
|
|
"indexes": [
|
|
models.Index(fields=["slug"], name="shows_show_slug_83daa9_idx"),
|
|
models.Index(fields=["is_published"], name="shows_show_is_publ_63247e_idx"),
|
|
],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Venue",
|
|
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=200)),
|
|
("slug", models.SlugField(max_length=220, unique=True)),
|
|
("address", models.CharField(max_length=255)),
|
|
("city", models.CharField(max_length=120)),
|
|
("notes", models.TextField(blank=True)),
|
|
],
|
|
options={
|
|
"ordering": ["name"],
|
|
"indexes": [
|
|
models.Index(fields=["slug"], name="shows_venue_slug_0717a3_idx"),
|
|
models.Index(fields=["city"], name="shows_venue_city_acfb26_idx"),
|
|
],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="Performance",
|
|
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)),
|
|
("starts_at", models.DateTimeField(db_index=True)),
|
|
("room_capacity", models.PositiveIntegerField()),
|
|
("manually_occupied_seats", models.PositiveIntegerField(default=0)),
|
|
("additional_seats", models.PositiveIntegerField(default=0)),
|
|
("is_booking_enabled", models.BooleanField(db_index=True, default=True)),
|
|
(
|
|
"show",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.PROTECT,
|
|
related_name="performances",
|
|
to="shows.show",
|
|
),
|
|
),
|
|
(
|
|
"venue",
|
|
models.ForeignKey(
|
|
on_delete=django.db.models.deletion.PROTECT,
|
|
related_name="performances",
|
|
to="shows.venue",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"ordering": ["starts_at"],
|
|
"indexes": [
|
|
models.Index(fields=["show", "starts_at"], name="shows_perfo_show_id_bae2ea_idx"),
|
|
models.Index(fields=["venue", "starts_at"], name="shows_perfo_venue_i_fcdf27_idx"),
|
|
models.Index(fields=["is_booking_enabled", "starts_at"], name="shows_perfo_is_book_9371e4_idx"),
|
|
],
|
|
"constraints": [
|
|
models.CheckConstraint(
|
|
condition=Q(("manually_occupied_seats__lte", F("room_capacity") + F("additional_seats"))),
|
|
name="performance_manual_seats_within_capacity",
|
|
),
|
|
],
|
|
},
|
|
),
|
|
]
|