netgescon-master/Database/migrations/2025_07_03_000000_create_allegati_table.php
Pikappa2 1b884feda5 v0.7 - UI Universale e Sistema Database Modernizzato
 Completato:
- Database modernizzato con chiavi id standard Laravel
- Relazioni corrette Amministratore→Stabili→Movimenti
- UI universale responsive con sidebar permission-based
- Codici alfanumerici 8 caratteri implementati
- Seeders con dati di test funzionanti
- Documentazione tecnica completa (INSTALL_LINUX, TECHNICAL_SPECS, UPDATE_SYSTEM)

🔧 Miglioramenti:
- Helper userSetting() funzionante
- Sistema multi-database preparato
- .gitignore aggiornato per sicurezza
- Migration cleanup e ottimizzazione

📚 Documentazione:
- Guida installazione Linux completa
- Specifiche tecniche dettagliate
- Sistema aggiornamenti progettato
- Progress log aggiornato
2025-07-07 17:24:30 +02:00

38 lines
1.4 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Crea la tabella allegati per la gestione degli allegati generici (morphable).
*/
public function up(): void
{
Schema::create('allegati', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('stabile_id')->nullable();
$table->string('nome_file_originale');
$table->string('nome_file_storage')->unique();
$table->text('percorso_file_storage');
$table->string('tipo_mime', 100);
$table->bigInteger('dimensione_byte')->unsigned();
$table->text('descrizione')->nullable();
$table->unsignedBigInteger('allegabile_id');
$table->string('allegabile_type', 100);
$table->unsignedBigInteger('id_utente_caricamento')->nullable();
$table->string('tags')->nullable();
$table->index(['allegabile_id', 'allegabile_type']);
$table->foreign('stabile_id')->references('id')->on('stabili')->onDelete('set null');
// $table->foreign('id_utente_caricamento')->references('id')->on('users')->onDelete('set null');
});
}
public function down(): void
{
Schema::dropIfExists('allegati');
}
};