Add initial migration for moderation app and resolve seed command issues

- Created an empty migration file for the moderation app to enable migrations.
- Documented the resolution of the seed command failure due to missing moderation tables.
- Identified and fixed a VARCHAR(10) constraint violation in the User model during seed data generation.
- Updated role assignment in the seed command to comply with the field length constraint.
This commit is contained in:
pacnpal
2025-09-25 08:39:05 -04:00
parent b1c369c1bb
commit 41b3c86437
13 changed files with 481 additions and 479 deletions

View File

@@ -0,0 +1,108 @@
from django.utils import timezone
from parks.models import Park, ParkLocation
from rides.models import Ride, RideModel, RollerCoasterStats
from rides.models import Manufacturer
# Create Cedar Point
park, _ = Park.objects.get_or_create(
name="Cedar Point",
slug="cedar-point",
defaults={
"description": (
"Cedar Point is a 364-acre amusement park located on a Lake Erie "
"peninsula in Sandusky, Ohio."
),
"website": "https://www.cedarpoint.com",
"size_acres": 364,
"opening_date": timezone.datetime(
1870, 1, 1
).date(), # Cedar Point opened in 1870
},
)
# Create location for Cedar Point
location, _ = ParkLocation.objects.get_or_create(
park=park,
defaults={
"street_address": "1 Cedar Point Dr",
"city": "Sandusky",
"state": "OH",
"postal_code": "44870",
"country": "USA",
},
)
# Set coordinates using the helper method
location.set_coordinates(-82.6839, 41.4822) # longitude, latitude
location.save()
# Create Intamin as manufacturer
bm, _ = Manufacturer.objects.get_or_create(
name="Intamin",
slug="intamin",
defaults={
"description": (
"Intamin Amusement Rides is a design company known for creating "
"some of the most thrilling and innovative roller coasters in the world."
),
"website": "https://www.intaminworldwide.com",
},
)
# Create Giga Coaster model
giga_model, _ = RideModel.objects.get_or_create(
name="Giga Coaster",
manufacturer=bm,
defaults={
"description": (
"A roller coaster type characterized by a height between 300399 feet "
"and a complete circuit."
),
"category": "RC", # Roller Coaster
},
)
# Create Millennium Force
millennium, _ = Ride.objects.get_or_create(
name="Millennium Force",
slug="millennium-force",
defaults={
"description": (
"Millennium Force is a steel roller coaster located at Cedar Point "
"amusement park in Sandusky, Ohio. It was built by Intamin of "
"Switzerland and opened on May 13, 2000 as the world's first giga "
"coaster, a class of roller coasters having a height between 300 "
"and 399 feet and a complete circuit."
),
"park": park,
"category": "RC",
"manufacturer": bm,
"ride_model": giga_model,
"status": "OPERATING",
"opening_date": timezone.datetime(2000, 5, 13).date(),
"min_height_in": 48, # 48 inches minimum height
"capacity_per_hour": 1300,
"ride_duration_seconds": 120, # 2 minutes
},
)
# Create stats for Millennium Force
RollerCoasterStats.objects.get_or_create(
ride=millennium,
defaults={
"height_ft": 310,
"length_ft": 6595,
"speed_mph": 93,
"inversions": 0,
"ride_time_seconds": 120,
"track_material": "STEEL",
"roller_coaster_type": "SITDOWN",
"max_drop_height_ft": 300,
"propulsion_system": "CHAIN",
"train_style": "Open-air stadium seating",
"trains_count": 3,
"cars_per_train": 9,
"seats_per_car": 4,
},
)
print("Initial data created successfully!")