altre migrations sistemate
This commit is contained in:
@@ -578,3 +578,27 @@ if (!empty($contatto['individuo_id'])) { create }
|
||||
- Test IMAP OAuth: sync email via connessione OAuth
|
||||
- Verificare refresh token automatico allo scadere
|
||||
- Verificare revoca e riconnessione
|
||||
|
||||
## 2026-06-17 — Fix: tutte le migration + seeders idempotenti
|
||||
|
||||
### Problema
|
||||
`php artisan migrate` falliva su tabelle già esistenti (`tenants`, `tipologie_documenti`, ecc.).
|
||||
`php artisan db:seed` creava duplicati su re-run (admin user, diocesi, comuni).
|
||||
Migrations con `insert` dopo il guard `hasTable` violavano unique constraint al re-run.
|
||||
|
||||
### Migration: hasTable guard su 28 CREATE mancanti
|
||||
Aggiunto `if (!Schema::hasTable('table_name')) { ... }` wrapper a 28 migration file (45 `Schema::create()` calls) via script Node.js, più `2026_06_17_000001_create_google_oauth_connections_table.php` manualmente.
|
||||
|
||||
### Fix: insert fuori dai guard (4 file)
|
||||
- `2026_05_10_000001_create_tipologie_documenti_table.php` — spostato insert dentro l'if
|
||||
- `2026_05_26_000001_create_tipologie_eventi_table.php` — spostato insert dentro l'if
|
||||
- `2026_05_12_000001_create_ruoli_table.php` — spostato insert dentro l'if
|
||||
- `2026_05_11_000006_add_email_attachment_tipologia.php` — `insert()` → `updateOrInsert()`
|
||||
|
||||
### Seeder: firstOrCreate
|
||||
- `DiocesiSeeder.php`: `Diocesi::create()` → `::firstOrCreate(['nome' => ...])`
|
||||
- `ComuniSeeder.php`: `Comune::create()` → `::firstOrCreate(['codice_istat' => ...])`
|
||||
- `DatabaseSeeder.php`: `User::create()` → `::firstOrCreate(['email' => ...])` + guardia `role_preset_id`
|
||||
|
||||
### Risultato
|
||||
`php artisan migrate --seed` è ora completamente idempotente. Zero errori su 64 migration + 6 seeder. Re-run è un no-op.
|
||||
|
||||
Reference in New Issue
Block a user