# Wiki Migration Guide ## Overview This guide explains how to migrate existing park and ride data to the new wiki-based system. ## Prerequisites 1. Backup your database 2. Ensure all django-wiki tables are created 3. Have superuser credentials ready ## Migration Process ### 1. Park Data Migration ```bash uv run manage.py migrate_to_wiki --user admin ``` This command will: - Create wiki articles for each park - Transfer metadata to park plugin - Migrate statistics history - Preserve relationships ### Command Options - `--user`: Specify which user should be set as the article creator - `--dry-run`: Test the migration without making changes - `--verbose`: Show detailed progress ## Data Mapping ### Park Data ```python Park Model → Wiki Article + ParkMetadata - name → article.current_revision.title - description → article.current_revision.content - location → metadata.location - opened_date → metadata.opened_date - operator → metadata.operator ``` ### Statistics ```python ParkStatistics → ParkMetadata.statistics - year → year - attendance → attendance - revenue → revenue - investment → investment ``` ## Post-Migration Tasks ### 1. Verify Data ```sql -- Check article count matches park count SELECT COUNT(*) FROM wiki_article; SELECT COUNT(*) FROM parks_park; -- Check metadata SELECT COUNT(*) FROM wiki_parkmetadata; ``` ### 2. Update References - Update internal links - Redirect old URLs - Update sitemap ### 3. Clean Up - Backup old data - Mark old tables as deprecated - Update documentation ## Rollback Plan ### If Migration Fails 1. Stop the migration process 2. Run cleanup command: ```bash uv run manage.py cleanup_failed_migration ``` 3. Restore from backup if needed ## Best Practices ### Before Migration 1. Run in test environment first 2. Back up all data 3. Notify users of maintenance window 4. Disable write access temporarily ### During Migration 1. Monitor progress 2. Keep logs 3. Watch for errors 4. Monitor system resources ### After Migration 1. Verify data integrity 2. Test functionality 3. Enable user access gradually 4. Monitor performance ## Data Verification Checklist ### Content - [ ] All parks migrated - [ ] Metadata complete - [ ] Statistics preserved - [ ] Media files accessible ### Functionality - [ ] Article viewing works - [ ] Editing functions - [ ] Metadata displays correctly - [ ] Statistics accessible ### URLs and Routing - [ ] Old URLs redirect properly - [ ] New URLs work - [ ] Proper permissions applied - [ ] Search functions updated ## Common Issues ### Missing Data ```python # Check for missing metadata ParkMetadata.objects.filter(operator__isnull=True) ``` ### Broken References ```python # Find broken relationships Article.objects.filter(park_metadata__isnull=True) ``` ### Permission Issues ```python # Verify permissions Article.objects.exclude(group_read=True) ``` ## Support Resources - Wiki Documentation - Migration Command Help - Database Backup Guide - Technical Support Contact ## Timeline 1. Preparation: 1-2 days 2. Migration: 2-4 hours 3. Verification: 1 day 4. Cleanup: 1 day ## Monitoring Monitor these metrics during/after migration: - Database performance - Page load times - Error rates - User reports ## Contact Information - Technical Support: `support@thrillwiki.com` - Wiki Admin: `wiki-admin@thrillwiki.com` - Emergency: `emergency@thrillwiki.com`