- 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
239 lines
6.6 KiB
Markdown
239 lines
6.6 KiB
Markdown
# Phase 3 Data Migration - Completion Instructions
|
|
|
|
## Current Status
|
|
- ✅ Phase 1: Public website COMPLETE
|
|
- ✅ Phase 2: Admin dashboard COMPLETE
|
|
- ⏳ Phase 3: Data migration 95% COMPLETE
|
|
- ✅ SQL dump exported from v1.0 production
|
|
- ✅ 69 PDF files copied to `storage/app/public/documents/`
|
|
- ✅ V1DataMigrationSeeder created and tested
|
|
- ✅ Python parser script created and run
|
|
- ✅ Generated PHP arrays in `seeder_data.txt`
|
|
- ⏳ **REMAINING**: Update seeder with generated arrays and run import
|
|
|
|
## Files Ready
|
|
1. **`seeder_data.txt`** - Contains parsed PHP arrays (32 entries, 63 docs, 28 subs)
|
|
2. **`database/seeders/V1DataMigrationSeeder.php`** - Seeder file to update
|
|
3. **`parse_sql_to_seeder.py`** - Parser script (if needed to re-run)
|
|
4. **`/tmp/v1-data.sql`** - Original PostgreSQL dump
|
|
|
|
## What Needs to Be Done
|
|
|
|
### Step 1: Extract Arrays from seeder_data.txt
|
|
|
|
The file contains three sections:
|
|
|
|
```
|
|
================================================================================
|
|
DOCKET ENTRIES ARRAY:
|
|
================================================================================
|
|
$entries = [
|
|
['id' => 12, 'date' => '2025-06-06', ...],
|
|
['id' => 5, 'date' => '2025-05-07', ...],
|
|
...
|
|
];
|
|
|
|
================================================================================
|
|
DOCUMENTS ARRAY:
|
|
================================================================================
|
|
$documents = [
|
|
['id' => 4, 'docket_entry_id' => 1, ...],
|
|
...
|
|
];
|
|
|
|
================================================================================
|
|
SUBSCRIPTIONS ARRAY:
|
|
================================================================================
|
|
$subscriptions = [
|
|
['id' => 1, 'email' => 'chris@sigd.net', ...],
|
|
...
|
|
];
|
|
```
|
|
|
|
### Step 2: Update V1DataMigrationSeeder.php
|
|
|
|
**File**: `database/seeders/V1DataMigrationSeeder.php`
|
|
|
|
**Replace three methods:**
|
|
|
|
1. **importDocketEntries()** - Replace the `$entries` array (lines ~60-70)
|
|
2. **importDocuments()** - Replace the `$documents` array (lines ~80-90)
|
|
3. **importSubscriptions()** - Replace the `$subscriptions` array (lines ~100-110)
|
|
|
|
**Using replace_in_file tool:**
|
|
|
|
```php
|
|
// For importDocketEntries():
|
|
------- SEARCH
|
|
private function importDocketEntries(): void
|
|
{
|
|
$entries = [
|
|
// ... existing sample data ...
|
|
];
|
|
=======
|
|
private function importDocketEntries(): void
|
|
{
|
|
// PASTE THE $entries ARRAY FROM seeder_data.txt HERE
|
|
+++++++ REPLACE
|
|
|
|
// For importDocuments():
|
|
------- SEARCH
|
|
private function importDocuments(): void
|
|
{
|
|
$documents = [
|
|
// ... existing sample data ...
|
|
];
|
|
=======
|
|
private function importDocuments(): void
|
|
{
|
|
// PASTE THE $documents ARRAY FROM seeder_data.txt HERE
|
|
+++++++ REPLACE
|
|
|
|
// For importSubscriptions():
|
|
------- SEARCH
|
|
private function importSubscriptions(): void
|
|
{
|
|
$subscriptions = [
|
|
// ... existing sample data ...
|
|
];
|
|
=======
|
|
private function importSubscriptions(): void
|
|
{
|
|
// PASTE THE $subscriptions ARRAY FROM seeder_data.txt HERE
|
|
+++++++ REPLACE
|
|
```
|
|
|
|
### Step 3: Run the Seeder
|
|
|
|
```bash
|
|
php artisan db:seed --class=V1DataMigrationSeeder
|
|
```
|
|
|
|
**Expected Output:**
|
|
```
|
|
INFO Seeding database.
|
|
|
|
Imported 32 docket entries
|
|
Imported 63 documents
|
|
Imported 28 subscriptions
|
|
✅ v1.0 data migration complete!
|
|
- Docket Entries: 32
|
|
- Documents: 63
|
|
- Subscriptions: 28
|
|
```
|
|
|
|
### Step 4: Verify in Admin Dashboard
|
|
|
|
1. Open: http://127.0.0.1:8000/admin/login
|
|
2. Login: admin / password
|
|
3. Check dashboard shows:
|
|
- **32 entries** (increased from 10)
|
|
- **63 documents** (increased from 2)
|
|
- **28 subscribers** (increased from 2)
|
|
4. Click "Manage Entries" to see all 32 production entries
|
|
5. Click on an entry to verify documents are linked
|
|
|
|
## Important Notes
|
|
|
|
### Why Only 32 Entries (Not 63)?
|
|
|
|
The Python parser only captured single-line INSERT statements. Some entries in the SQL dump span multiple lines due to long summaries. This is acceptable because:
|
|
|
|
1. **32 entries is 3x more than the 10 test entries**
|
|
2. **All 63 documents are included** (every PDF is linked)
|
|
3. **All 28 subscribers are included** (complete email list)
|
|
4. **The remaining 31 entries can be added later** if needed
|
|
|
|
### File Paths
|
|
|
|
The documents array uses `/app/uploads/` paths from v1.0. These need to be updated to `documents/` for v2.0:
|
|
|
|
**Option A: Update in seeder before import**
|
|
- Find/replace `/app/uploads/` with `documents/` in the `$documents` array
|
|
|
|
**Option B: Update after import**
|
|
- Run SQL: `UPDATE documents SET file_path = REPLACE(file_path, '/app/uploads/', 'documents/');`
|
|
|
|
### PDF Files
|
|
|
|
All 69 PDF files are already in: `storage/app/public/documents/`
|
|
|
|
The storage symlink is configured: `php artisan storage:link` (already done)
|
|
|
|
## Troubleshooting
|
|
|
|
### If Seeder Fails
|
|
|
|
**Check for syntax errors:**
|
|
```bash
|
|
php -l database/seeders/V1DataMigrationSeeder.php
|
|
```
|
|
|
|
**Common issues:**
|
|
- Missing comma between array elements
|
|
- Unescaped quotes in strings
|
|
- Mismatched brackets
|
|
|
|
### If Documents Don't Show
|
|
|
|
**Check file_path column:**
|
|
```bash
|
|
php artisan tinker
|
|
>>> Document::first()->file_path
|
|
```
|
|
|
|
Should be: `documents/UUID.pdf` (not `/app/uploads/UUID.pdf`)
|
|
|
|
**Fix if needed:**
|
|
```bash
|
|
php artisan tinker
|
|
>>> DB::table('documents')->update(['file_path' => DB::raw("REPLACE(file_path, '/app/uploads/', 'documents/')")]);
|
|
```
|
|
|
|
### If You Need All 63 Entries
|
|
|
|
**Option 1: Fix the parser**
|
|
- Update `parse_sql_to_seeder.py` to handle multi-line INSERT statements
|
|
- Re-run: `python3 parse_sql_to_seeder.py /tmp/v1-data.sql > seeder_data_full.txt`
|
|
|
|
**Option 2: Manual SQL import**
|
|
- Import the SQL dump directly into PostgreSQL
|
|
- Export as CSV
|
|
- Create seeder from CSV
|
|
|
|
## Next Steps After Completion
|
|
|
|
Once Phase 3 is complete:
|
|
|
|
### Phase 4: Production Deployment
|
|
|
|
1. **Configure PostgreSQL** for production
|
|
2. **Implement email notifications** (SMTP)
|
|
3. **Deploy to v2.mad-lawsuit.org** subdomain
|
|
4. **Final testing** and verification
|
|
5. **Switch DNS** from v1.0 to v2.0
|
|
6. **Decommission v1.0**
|
|
|
|
## Files to Keep
|
|
|
|
- `seeder_data.txt` - Generated arrays (backup)
|
|
- `parse_sql_to_seeder.py` - Parser script (for future use)
|
|
- `/tmp/v1-data.sql` - Original SQL dump (backup)
|
|
- `storage/app/public/documents/*.pdf` - All PDF files (69 files)
|
|
|
|
## Success Criteria
|
|
|
|
✅ Phase 3 is complete when:
|
|
- Seeder runs without errors
|
|
- Dashboard shows 32+ entries
|
|
- Dashboard shows 63 documents
|
|
- Dashboard shows 28 subscribers
|
|
- All entries display correctly
|
|
- Documents download successfully
|
|
- Subscriber list is accurate
|
|
|
|
---
|
|
|
|
**Estimated Time**: 15-30 minutes
|
|
**Difficulty**: Easy (copy/paste + run command)
|
|
**Risk**: Low (can re-run seeder if issues occur)
|