feat: infrastructure assets management with warranty tracking and EAN lookup integration
This commit is contained in:
@@ -11,7 +11,13 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::statement("ALTER TABLE pieces_jointes MODIFY type ENUM('devis', 'bon_commande', 'bon_livraison', 'facture', 'autre', 'contrat', 'avenant') NOT NULL;");
|
||||
if (Schema::getConnection()->getDriverName() === 'mysql') {
|
||||
\Illuminate\Support\Facades\DB::statement("ALTER TABLE pieces_jointes MODIFY type ENUM('devis', 'bon_commande', 'bon_livraison', 'facture', 'autre', 'contrat', 'avenant') NOT NULL;");
|
||||
} else {
|
||||
Schema::table('pieces_jointes', function (Blueprint $table) {
|
||||
$table->string('type')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -19,6 +25,12 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
\Illuminate\Support\Facades\DB::statement("ALTER TABLE pieces_jointes MODIFY type ENUM('devis', 'bon_commande', 'bon_livraison', 'facture', 'autre') NOT NULL;");
|
||||
if (Schema::getConnection()->getDriverName() === 'mysql') {
|
||||
\Illuminate\Support\Facades\DB::statement("ALTER TABLE pieces_jointes MODIFY type ENUM('devis', 'bon_commande', 'bon_livraison', 'facture', 'autre') NOT NULL;");
|
||||
} else {
|
||||
Schema::table('pieces_jointes', function (Blueprint $table) {
|
||||
$table->string('type')->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('communes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nom')->unique();
|
||||
$table->string('code_postal')->nullable(); // Optionnel mais utile
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('communes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('commandes', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('commandes', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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::table('commandes', function (Blueprint $table) {
|
||||
$table->foreignId('commune_id')->nullable()->after('id')->constrained('communes')->nullOnDelete();
|
||||
});
|
||||
|
||||
Schema::table('contrats', function (Blueprint $table) {
|
||||
$table->foreignId('commune_id')->nullable()->after('id')->constrained('communes')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('commandes', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('commune_id');
|
||||
});
|
||||
|
||||
Schema::table('contrats', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('commune_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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('licences', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('contrat_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('fournisseur_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('commune_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('nom');
|
||||
$table->text('cle_licence')->nullable();
|
||||
$table->integer('nombre_sieges_total')->default(1);
|
||||
$table->integer('nombre_sieges_utilises')->default(0);
|
||||
$table->date('date_acquisition')->nullable();
|
||||
$table->date('date_expiration')->nullable();
|
||||
$table->enum('type_licence', ['perpétuelle', 'abonnement'])->default('abonnement');
|
||||
$table->enum('statut', ['active', 'expirée', 'résiliée'])->default('active');
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('licences');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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('assets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('nom');
|
||||
$table->string('type'); // Serveur, Switch, NAS, Baie, etc.
|
||||
$table->string('marque')->nullable();
|
||||
$table->string('modele')->nullable();
|
||||
$table->string('numero_serie')->nullable();
|
||||
$table->string('emplacement')->nullable();
|
||||
$table->foreignId('commune_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->date('date_achat')->nullable();
|
||||
$table->date('date_fin_garantie')->nullable();
|
||||
$table->enum('statut', ['en_service', 'hors_service', 'en_reparation', 'stock'])->default('en_service');
|
||||
$table->text('notes')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('assets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('assets', function (Blueprint $table) {
|
||||
$table->foreignId('commande_id')->nullable()->after('commune_id')->constrained()->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('commande_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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::table('assets', function (Blueprint $table) {
|
||||
$table->string('code_ean')->nullable()->after('type');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('assets', function (Blueprint $table) {
|
||||
$table->dropColumn('code_ean');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user