mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 17:51:08 -05:00
294 lines
14 KiB
Python
294 lines
14 KiB
Python
# Generated by Django 5.1.4 on 2025-02-10 09:32
|
|
|
|
import django.db.models.deletion
|
|
import pgtrigger.compiler
|
|
import pgtrigger.migrations
|
|
from django.db import migrations, models
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("designers", "0001_initial"),
|
|
("companies", "0001_initial"),
|
|
("parks", "0002_fix_pghistory_fields"), # This dependency is important for pghistory fields
|
|
("pghistory", "0006_delete_aggregateevent"),
|
|
("rides", "0002_ridemodel"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="RideEvent",
|
|
fields=[
|
|
("pgh_id", models.AutoField(primary_key=True, serialize=False)),
|
|
("pgh_created_at", models.DateTimeField(auto_now_add=True)),
|
|
("pgh_label", models.TextField(help_text="The event label.")),
|
|
("id", models.BigIntegerField()),
|
|
("name", models.CharField(max_length=255)),
|
|
("slug", models.SlugField(db_index=False, max_length=255)),
|
|
("description", models.TextField(blank=True)),
|
|
(
|
|
"category",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("", "Select ride type"),
|
|
("RC", "Roller Coaster"),
|
|
("DR", "Dark Ride"),
|
|
("FR", "Flat Ride"),
|
|
("WR", "Water Ride"),
|
|
("TR", "Transport"),
|
|
("OT", "Other"),
|
|
],
|
|
default="",
|
|
max_length=2,
|
|
),
|
|
),
|
|
(
|
|
"status",
|
|
models.CharField(
|
|
choices=[
|
|
("OPERATING", "Operating"),
|
|
("SBNO", "Standing But Not Operating"),
|
|
("CLOSING", "Closing"),
|
|
("CLOSED_PERM", "Permanently Closed"),
|
|
("UNDER_CONSTRUCTION", "Under Construction"),
|
|
("DEMOLISHED", "Demolished"),
|
|
("RELOCATED", "Relocated"),
|
|
],
|
|
default="OPERATING",
|
|
max_length=20,
|
|
),
|
|
),
|
|
(
|
|
"post_closing_status",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("SBNO", "Standing But Not Operating"),
|
|
("CLOSED_PERM", "Permanently Closed"),
|
|
],
|
|
help_text="Status to change to after closing date",
|
|
max_length=20,
|
|
null=True,
|
|
),
|
|
),
|
|
("opening_date", models.DateField(blank=True, null=True)),
|
|
("closing_date", models.DateField(blank=True, null=True)),
|
|
("status_since", models.DateField(blank=True, null=True)),
|
|
("min_height_in", models.PositiveIntegerField(blank=True, null=True)),
|
|
("max_height_in", models.PositiveIntegerField(blank=True, null=True)),
|
|
("capacity_per_hour", models.PositiveIntegerField(blank=True, null=True)),
|
|
("ride_duration_seconds", models.PositiveIntegerField(blank=True, null=True)),
|
|
(
|
|
"average_rating",
|
|
models.DecimalField(
|
|
blank=True, decimal_places=2, max_digits=3, null=True
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"designer",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="designers.designer",
|
|
),
|
|
),
|
|
(
|
|
"manufacturer",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="companies.manufacturer",
|
|
),
|
|
),
|
|
(
|
|
"park",
|
|
models.ForeignKey(
|
|
db_constraint=False,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="parks.park",
|
|
),
|
|
),
|
|
(
|
|
"park_area",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="parks.parkarea",
|
|
),
|
|
),
|
|
(
|
|
"pgh_context",
|
|
models.ForeignKey(
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
to="pghistory.context",
|
|
),
|
|
),
|
|
(
|
|
"pgh_obj",
|
|
models.ForeignKey(
|
|
db_constraint=False,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="events",
|
|
to="rides.ride",
|
|
),
|
|
),
|
|
(
|
|
"ride_model",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
db_constraint=False,
|
|
help_text="The specific model/type of this ride",
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="rides.ridemodel",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name="RideModelEvent",
|
|
fields=[
|
|
("pgh_id", models.AutoField(primary_key=True, serialize=False)),
|
|
("pgh_created_at", models.DateTimeField(auto_now_add=True)),
|
|
("pgh_label", models.TextField(help_text="The event label.")),
|
|
("id", models.BigIntegerField()),
|
|
("name", models.CharField(max_length=255)),
|
|
("description", models.TextField(blank=True)),
|
|
(
|
|
"category",
|
|
models.CharField(
|
|
blank=True,
|
|
choices=[
|
|
("", "Select ride type"),
|
|
("RC", "Roller Coaster"),
|
|
("DR", "Dark Ride"),
|
|
("FR", "Flat Ride"),
|
|
("WR", "Water Ride"),
|
|
("TR", "Transport"),
|
|
("OT", "Other"),
|
|
],
|
|
default="",
|
|
max_length=2,
|
|
),
|
|
),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"manufacturer",
|
|
models.ForeignKey(
|
|
blank=True,
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
related_query_name="+",
|
|
to="companies.manufacturer",
|
|
),
|
|
),
|
|
(
|
|
"pgh_context",
|
|
models.ForeignKey(
|
|
db_constraint=False,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="+",
|
|
to="pghistory.context",
|
|
),
|
|
),
|
|
(
|
|
"pgh_obj",
|
|
models.ForeignKey(
|
|
db_constraint=False,
|
|
on_delete=django.db.models.deletion.DO_NOTHING,
|
|
related_name="events",
|
|
to="rides.ridemodel",
|
|
),
|
|
),
|
|
],
|
|
options={
|
|
"abstract": False,
|
|
},
|
|
),
|
|
pgtrigger.migrations.AddTrigger(
|
|
model_name="ridemodel",
|
|
trigger=pgtrigger.compiler.Trigger(
|
|
name="insert_insert",
|
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
|
func='INSERT INTO "rides_ridemodelevent" ("category", "created_at", "description", "id", "manufacturer_id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."manufacturer_id", NEW."name", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."updated_at"); RETURN NULL;',
|
|
hash="[AWS-SECRET-REMOVED]",
|
|
operation="INSERT",
|
|
pgid="pgtrigger_insert_insert_0aaee",
|
|
table="rides_ridemodel",
|
|
when="AFTER",
|
|
),
|
|
),
|
|
),
|
|
pgtrigger.migrations.AddTrigger(
|
|
model_name="ridemodel",
|
|
trigger=pgtrigger.compiler.Trigger(
|
|
name="update_update",
|
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
|
condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
|
|
func='INSERT INTO "rides_ridemodelevent" ("category", "created_at", "description", "id", "manufacturer_id", "name", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "updated_at") VALUES (NEW."category", NEW."created_at", NEW."description", NEW."id", NEW."manufacturer_id", NEW."name", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."updated_at"); RETURN NULL;',
|
|
hash="[AWS-SECRET-REMOVED]",
|
|
operation="UPDATE",
|
|
pgid="pgtrigger_update_update_0ca1a",
|
|
table="rides_ridemodel",
|
|
when="AFTER",
|
|
),
|
|
),
|
|
),
|
|
pgtrigger.migrations.AddTrigger(
|
|
model_name="ride",
|
|
trigger=pgtrigger.compiler.Trigger(
|
|
name="insert_insert",
|
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
|
func='INSERT INTO "rides_rideevent" ("average_rating", "capacity_per_hour", "category", "closing_date", "created_at", "description", "designer_id", "id", "manufacturer_id", "max_height_in", "min_height_in", "name", "opening_date", "park_area_id", "park_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "post_closing_status", "ride_duration_seconds", "ride_model_id", "slug", "status", "status_since", "updated_at") VALUES (NEW."average_rating", NEW."capacity_per_hour", NEW."category", NEW."closing_date", NEW."created_at", NEW."description", NEW."designer_id", NEW."id", NEW."manufacturer_id", NEW."max_height_in", NEW."min_height_in", NEW."name", NEW."opening_date", NEW."park_area_id", NEW."park_id", _pgh_attach_context(), NOW(), \'insert\', NEW."id", NEW."post_closing_status", NEW."ride_duration_seconds", NEW."ride_model_id", NEW."slug", NEW."status", NEW."status_since", NEW."updated_at"); RETURN NULL;',
|
|
hash="[AWS-SECRET-REMOVED]",
|
|
operation="INSERT",
|
|
pgid="pgtrigger_insert_insert_52074",
|
|
table="rides_ride",
|
|
when="AFTER",
|
|
),
|
|
),
|
|
),
|
|
pgtrigger.migrations.AddTrigger(
|
|
model_name="ride",
|
|
trigger=pgtrigger.compiler.Trigger(
|
|
name="update_update",
|
|
sql=pgtrigger.compiler.UpsertTriggerSql(
|
|
condition="WHEN (OLD.* IS DISTINCT FROM NEW.*)",
|
|
func='INSERT INTO "rides_rideevent" ("average_rating", "capacity_per_hour", "category", "closing_date", "created_at", "description", "designer_id", "id", "manufacturer_id", "max_height_in", "min_height_in", "name", "opening_date", "park_area_id", "park_id", "pgh_context_id", "pgh_created_at", "pgh_label", "pgh_obj_id", "post_closing_status", "ride_duration_seconds", "ride_model_id", "slug", "status", "status_since", "updated_at") VALUES (NEW."average_rating", NEW."capacity_per_hour", NEW."category", NEW."closing_date", NEW."created_at", NEW."description", NEW."designer_id", NEW."id", NEW."manufacturer_id", NEW."max_height_in", NEW."min_height_in", NEW."name", NEW."opening_date", NEW."park_area_id", NEW."park_id", _pgh_attach_context(), NOW(), \'update\', NEW."id", NEW."post_closing_status", NEW."ride_duration_seconds", NEW."ride_model_id", NEW."slug", NEW."status", NEW."status_since", NEW."updated_at"); RETURN NULL;',
|
|
hash="[AWS-SECRET-REMOVED]",
|
|
operation="UPDATE",
|
|
pgid="pgtrigger_update_update_4917a",
|
|
table="rides_ride",
|
|
when="AFTER",
|
|
),
|
|
),
|
|
),
|
|
] |