add nertwork_id to nh_validations_agents

This commit is contained in:
root 2025-10-29 10:39:13 +01:00
parent e2562a79eb
commit 42ee42d79c
2 changed files with 53 additions and 10 deletions

View File

@ -13,34 +13,36 @@ class CreateCustomerAccountTables extends Migration
*/
public function up()
{
// Table principale : customer_account_types
// Table des types de comptes clients
Schema::create('customer_account_types', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->text('description')->nullable();
$table->decimal('opening_amount', 15, 2)->nullable();
$table->integer('opening_amount_payment_period_days')->nullable();
$table->unsignedBigInteger('parent_id')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->foreign('parent_id')
->references('id')
->on('customer_account_types')
->onDelete('set null');
->references('id')
->on('customer_account_types')
->onDelete('set null');
});
// Table liée : customer_account_type_documents
// Table des documents liés aux types de comptes
Schema::create('customer_account_type_documents', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('account_type_id');
$table->string('document_name');
$table->boolean('is_mandatory')->default(false);
$table->string('name');
$table->text('description')->nullable();
$table->boolean('is_mandatory')->default(false);
$table->timestamps();
$table->foreign('account_type_id')
->references('id')
->on('customer_account_types')
->onDelete('cascade');
->references('id')
->on('customer_account_types')
->onDelete('cascade');
});
}

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddNetworkIdToNhValidatingAgentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nh_validating_agents', function (Blueprint $table) {
// Add the new column (nullable if you want to fill it later)
$table->unsignedBigInteger('network_id')->nullable()->after('id');
// Add the foreign key constraint
$table->foreign('network_id')
->references('id')
->on('networks')
->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nh_validating_agents', function (Blueprint $table) {
// Drop the foreign key first, then the column
$table->dropForeign(['network_id']);
$table->dropColumn('network_id');
});
}
}