43 lines
1.5 KiB
PHP
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');
|
|
}
|
|
};
|