mad-lawsuit/update_seeder_v2.py
TheMaddax b7125cf2b7 Phase 4: Production deployment configuration
- Add Docker configuration (Dockerfile, docker-compose.yml)
- Add Nginx and Supervisor configuration
- Add deployment documentation (DEPLOYMENT.md)
- Complete Phase 3 data migration (63 entries, 63 docs, 28 subs)
- Add responsive PDF viewer component
- Fix date format to American (MM/DD/YYYY)
- Update typography to match v1.0
- Add admin dashboard with full CRUD operations
- Configure PostgreSQL with secure password
- Connect to caddy_network for reverse proxy
- Ready for production deployment
2025-12-17 19:12:32 -07:00

81 lines
2.9 KiB
Python

#!/usr/bin/env python3
"""
Script to update V1DataMigrationSeeder.php with production data arrays from seeder_data_full.txt
Also fixes file paths from /app/uploads/ to documents/
"""
import re
# Read the seeder_data_full.txt file
with open('seeder_data_full.txt', 'r') as f:
content = f.read()
# Extract the three arrays using regex
entries_match = re.search(r'DOCKET ENTRIES ARRAY:\s*={80,}\s*(\$entries = \[.*?\];)', content, re.DOTALL)
documents_match = re.search(r'DOCUMENTS ARRAY:\s*={80,}\s*(\$documents = \[.*?\];)', content, re.DOTALL)
subscriptions_match = re.search(r'SUBSCRIPTIONS ARRAY:\s*={80,}\s*(\$subscriptions = \[.*?\];)', content, re.DOTALL)
if not all([entries_match, documents_match, subscriptions_match]):
print("❌ Error: Could not extract all arrays from seeder_data_full.txt")
exit(1)
entries_array = entries_match.group(1)
documents_array = documents_match.group(1)
subscriptions_array = subscriptions_match.group(1)
# Fix file paths in documents array: /app/uploads/ -> documents/
documents_array = documents_array.replace("'/app/uploads/", "'documents/")
# Count entries
entries_count = entries_array.count("['id' =>")
documents_count = documents_array.count("['id' =>")
subscriptions_count = subscriptions_array.count("['id' =>")
print(f"✅ Extracted arrays:")
print(f" - Docket entries: {entries_count} items")
print(f" - Documents: {documents_count} items")
print(f" - Subscriptions: {subscriptions_count} items")
print(f" - Fixed file paths: /app/uploads/ -> documents/")
# Read the current seeder file
with open('database/seeders/V1DataMigrationSeeder.php', 'r') as f:
seeder_content = f.read()
# Replace the arrays in the three methods
# 1. Replace docket entries array
seeder_content = re.sub(
r'(private function importDocketEntries\(\): void\s*\{\s*)\$entries = \[.*?\];',
r'\1' + entries_array,
seeder_content,
flags=re.DOTALL
)
# 2. Replace documents array
seeder_content = re.sub(
r'(private function importDocuments\(\): void\s*\{\s*)\$documents = \[.*?\];',
r'\1' + documents_array,
seeder_content,
flags=re.DOTALL
)
# 3. Replace subscriptions array
seeder_content = re.sub(
r'(private function importSubscriptions\(\): void\s*\{\s*)\$subscriptions = \[.*?\];',
r'\1' + subscriptions_array,
seeder_content,
flags=re.DOTALL
)
# Write the updated seeder file
with open('database/seeders/V1DataMigrationSeeder.php', 'w') as f:
f.write(seeder_content)
print("✅ Updated V1DataMigrationSeeder.php successfully!")
print(f"\nExpected counts after import:")
print(f" - Docket Entries: {entries_count}")
print(f" - Documents: {documents_count}")
print(f" - Subscriptions: {subscriptions_count}")
print("\nNext steps:")
print("1. Clear database: php artisan migrate:fresh --seed --seeder=AdminSeeder")
print("2. Run migration: php artisan db:seed --class=V1DataMigrationSeeder")
print("3. Verify data in admin dashboard")