- 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
75 lines
2.7 KiB
Python
75 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Script to update V1DataMigrationSeeder.php with production data arrays from seeder_data.txt
|
|
Also fixes file paths from /app/uploads/ to documents/
|
|
"""
|
|
|
|
import re
|
|
|
|
# Read the seeder_data.txt file
|
|
with open('seeder_data.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.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/")
|
|
|
|
print(f"✅ Extracted arrays:")
|
|
print(f" - Docket entries: {entries_array.count('[')} items")
|
|
print(f" - Documents: {documents_array.count('[')} items")
|
|
print(f" - Subscriptions: {subscriptions_array.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
|
|
)
|
|
|
|
# Update the info messages to remove "(sample - will add all X)"
|
|
seeder_content = seeder_content.replace(" (sample - will add all 63)", "")
|
|
seeder_content = seeder_content.replace(" (sample - will add all 28)", "")
|
|
|
|
# Write the updated seeder file
|
|
with open('database/seeders/V1DataMigrationSeeder.php', 'w') as f:
|
|
f.write(seeder_content)
|
|
|
|
print("✅ Updated V1DataMigrationSeeder.php successfully!")
|
|
print("\nNext steps:")
|
|
print("1. Run: php artisan db:seed --class=V1DataMigrationSeeder")
|
|
print("2. Verify data in admin dashboard")
|