# Generated by Django 5.2.5 on 2025-08-16 17:42 import django.db.models.functions.datetime from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("parks", "0003_add_business_constraints"), ("rides", "0001_initial"), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("closing_date__isnull", True), ("opening_date__isnull", True), ("closing_date__gte", models.F("opening_date")), _connector="OR", ), name="ride_closing_after_opening", violation_error_message="Closing date must be after opening date", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("min_height_in__isnull", True), ("max_height_in__isnull", True), ("min_height_in__lte", models.F("max_height_in")), _connector="OR", ), name="ride_height_requirements_logical", violation_error_message="Minimum height cannot exceed maximum height", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("min_height_in__isnull", True), models.Q(("min_height_in__gte", 30), ("min_height_in__lte", 90)), _connector="OR", ), name="ride_min_height_reasonable", violation_error_message="Minimum height must be between 30 and 90 inches", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("max_height_in__isnull", True), models.Q(("max_height_in__gte", 30), ("max_height_in__lte", 90)), _connector="OR", ), name="ride_max_height_reasonable", violation_error_message="Maximum height must be between 30 and 90 inches", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("average_rating__isnull", True), models.Q(("average_rating__gte", 1), ("average_rating__lte", 10)), _connector="OR", ), name="ride_rating_range", violation_error_message="Average rating must be between 1 and 10", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("capacity_per_hour__isnull", True), ("capacity_per_hour__gt", 0), _connector="OR", ), name="ride_capacity_positive", violation_error_message="Hourly capacity must be positive", ), ), migrations.AddConstraint( model_name="ride", constraint=models.CheckConstraint( condition=models.Q( ("ride_duration_seconds__isnull", True), ("ride_duration_seconds__gt", 0), _connector="OR", ), name="ride_duration_positive", violation_error_message="Ride duration must be positive", ), ), migrations.AddConstraint( model_name="ridereview", constraint=models.CheckConstraint( condition=models.Q(("rating__gte", 1), ("rating__lte", 10)), name="ride_review_rating_range", violation_error_message="Rating must be between 1 and 10", ), ), migrations.AddConstraint( model_name="ridereview", constraint=models.CheckConstraint( condition=models.Q( ("visit_date__lte", django.db.models.functions.datetime.Now()) ), name="ride_review_visit_date_not_future", violation_error_message="Visit date cannot be in the future", ), ), migrations.AddConstraint( model_name="ridereview", constraint=models.CheckConstraint( condition=models.Q( models.Q( ("moderated_at__isnull", True), ("moderated_by__isnull", True) ), models.Q( ("moderated_at__isnull", False), ("moderated_by__isnull", False) ), _connector="OR", ), name="ride_review_moderation_consistency", violation_error_message="Moderated reviews must have both moderator and moderation timestamp", ), ), ]