✅ 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
38 lines
1.7 KiB
PHP
38 lines
1.7 KiB
PHP
<?php
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration {
|
|
public function up(): void
|
|
{
|
|
Schema::create('documenti', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('protocollo')->nullable()->unique(); // es. 2025-0001
|
|
$table->date('data_protocollo')->nullable();
|
|
$table->string('tipo_documento')->nullable(); // Fattura, Contratto, Verbale, ecc.
|
|
$table->unsignedBigInteger('stabile_id')->nullable();
|
|
$table->unsignedBigInteger('fornitore_id')->nullable();
|
|
$table->unsignedBigInteger('esercizio_contabile_id')->nullable();
|
|
$table->text('descrizione')->nullable();
|
|
$table->decimal('importo', 12, 2)->nullable();
|
|
$table->date('data_documento')->nullable();
|
|
$table->string('nome_file');
|
|
$table->string('path_file');
|
|
$table->text('testo_estratto_ocr')->nullable();
|
|
// Polimorfismo
|
|
$table->unsignedBigInteger('documentable_id')->nullable()->index();
|
|
$table->string('documentable_type')->nullable()->index();
|
|
$table->timestamps();
|
|
// FK opzionali
|
|
$table->foreign('stabile_id')->references('id')->on('stabili')->onDelete('set null');
|
|
$table->foreign('fornitore_id')->references('id')->on('fornitori')->onDelete('set null');
|
|
// $table->foreign('esercizio_contabile_id')->references('id')->on('esercizi_contabili')->onDelete('set null'); // FK disabilitata: tabella non ancora presente
|
|
});
|
|
}
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('documenti');
|
|
}
|
|
};
|