# Consolidation Analysis

## Review System Implementation

### Current Implementation
- Uses Django's GenericForeignKey (confirmed)
- Single Review model handles both parks and rides
- Related models: ReviewImage, ReviewLike, ReviewReport
- Content types: Currently supports any model type

### Migration Plan

1. **Create New Models**:
```python
# parks/models/reviews.py
class ParkReview(TrackedModel):
    park = models.ForeignKey(Park, on_delete=models.CASCADE)
    # ... other review fields ...

# rides/models/reviews.py
class RideReview(TrackedModel):
    ride = models.ForeignKey(Ride, on_delete=models.CASCADE)
    # ... other review fields ...
```

2. **Data Migration Steps**:
```python
# Migration operations
def migrate_reviews(apps, schema_editor):
    Review = apps.get_model('reviews', 'Review')
    ParkReview = apps.get_model('parks', 'ParkReview')
    RideReview = apps.get_model('rides', 'RideReview')
    
    for review in Review.objects.all():
        if review.content_type.model == 'park':
            ParkReview.objects.create(
                park_id=review.object_id,
                # ... map other fields ...
            )
        elif review.content_type.model == 'ride':
            RideReview.objects.create(
                ride_id=review.object_id,
                # ... map other fields ...
            )
```

3. **Update Related Models**:
```python
# Before (generic)
class ReviewImage(models.Model):
    review = models.ForeignKey(Review, ...)

# After (concrete)
class ParkReviewImage(models.Model):
    review = models.ForeignKey(ParkReview, ...)

class RideReviewImage(models.Model):
    review = models.ForeignKey(RideReview, ...)
```

4. **Backward Compatibility**:
- Maintain old Review API during transition period
- Phase out generic reviews after data migration

### Entity Relationship Compliance
- Park reviews will reference Park model (via Operator)
- Ride reviews will reference Ride model (via Park → Operator)
- Complies with entity relationship rules in .clinerules

### Risk Mitigation
- Use data migration transactions
- Create database backups before migration
- Test with staging data first