From 42ee42d79cca7da7b6f389ac06a715ee2ea77045 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 29 Oct 2025 10:39:13 +0100 Subject: [PATCH] add nertwork_id to nh_validations_agents --- ..._145935_create_customer_account_tables.php | 22 +++++----- ...twork_id_to_nh_validating_agents_table.php | 41 +++++++++++++++++++ 2 files changed, 53 insertions(+), 10 deletions(-) create mode 100755 database/migrations/2025_10_29_092443_add_network_id_to_nh_validating_agents_table.php diff --git a/database/migrations/2025_10_21_145935_create_customer_account_tables.php b/database/migrations/2025_10_21_145935_create_customer_account_tables.php index bd0d931..51c3bf3 100755 --- a/database/migrations/2025_10_21_145935_create_customer_account_tables.php +++ b/database/migrations/2025_10_21_145935_create_customer_account_tables.php @@ -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'); }); } diff --git a/database/migrations/2025_10_29_092443_add_network_id_to_nh_validating_agents_table.php b/database/migrations/2025_10_29_092443_add_network_id_to_nh_validating_agents_table.php new file mode 100755 index 0000000..75945b5 --- /dev/null +++ b/database/migrations/2025_10_29_092443_add_network_id_to_nh_validating_agents_table.php @@ -0,0 +1,41 @@ +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'); + }); + } +}