Files
dsi-commander/database/migrations/2026_04_08_120939_create_contrats_table.php

37 lines
1.1 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('contrats', function (Blueprint $table) {
$table->id();
$table->string('titre');
$table->text('description')->nullable();
$table->foreignId('fournisseur_id')->constrained('fournisseurs')->onDelete('cascade');
$table->foreignId('service_id')->constrained('services')->onDelete('cascade');
$table->date('date_debut')->nullable();
$table->date('date_echeance');
$table->enum('statut', ['actif', 'a_renouveler', 'expire', 'resilie'])->default('actif');
$table->decimal('montant', 10, 2)->nullable();
$table->integer('preavis_jours')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('contrats');
}
};