netgescon-master/database/migrations/2025_07_08_151654_create_rate_table.php
Pikappa2 2d6fba0e60 🔧 Risoluzione errori migrazioni e aggiornamento DATA_ARCHITECTURE.md
- Corretti errori di foreign key nelle migrazioni
- Rimosso userSetting() non definito e aggiunto helpers.php
- Aggiornati modelli PianoRateizzazione e Rata con relazioni corrette
- Aggiornato DATA_ARCHITECTURE.md con nuovi modelli per ripartizione spese
- Corrette dipendenze tra tabelle nelle migrazioni
2025-07-09 00:47:16 +02:00

43 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('rate', function (Blueprint $table) {
$table->id();
$table->string('codice_rata')->unique();
$table->foreignId('piano_rateizzazione_id')->constrained('piano_rateizzazione')->cascadeOnDelete();
$table->foreignId('ripartizione_spese_id')->constrained('ripartizione_spese')->cascadeOnDelete();
$table->integer('numero_rata');
$table->decimal('importo_rata', 10, 2);
$table->date('data_scadenza');
$table->string('stato')->default('attiva'); // attiva, pagata, scaduta, annullata
$table->date('data_pagamento')->nullable();
$table->decimal('importo_pagato', 10, 2)->nullable();
$table->string('modalita_pagamento')->nullable();
$table->string('riferimento_pagamento')->nullable();
$table->text('note')->nullable();
$table->foreignId('registrato_da')->nullable()->constrained('users');
$table->timestamp('registrato_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('rate');
}
};