add nertwork_id to nh_validations_agents
This commit is contained in:
parent
e2562a79eb
commit
42ee42d79c
|
|
@ -13,34 +13,36 @@ class CreateCustomerAccountTables extends Migration
|
||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
// Table principale : customer_account_types
|
// Table des types de comptes clients
|
||||||
Schema::create('customer_account_types', function (Blueprint $table) {
|
Schema::create('customer_account_types', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->text('description')->nullable();
|
$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->unsignedBigInteger('parent_id')->nullable();
|
||||||
$table->boolean('active')->default(true);
|
$table->boolean('active')->default(true);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('parent_id')
|
$table->foreign('parent_id')
|
||||||
->references('id')
|
->references('id')
|
||||||
->on('customer_account_types')
|
->on('customer_account_types')
|
||||||
->onDelete('set null');
|
->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) {
|
Schema::create('customer_account_type_documents', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('account_type_id');
|
$table->unsignedBigInteger('account_type_id');
|
||||||
$table->string('document_name');
|
$table->string('name');
|
||||||
$table->boolean('is_mandatory')->default(false);
|
|
||||||
$table->text('description')->nullable();
|
$table->text('description')->nullable();
|
||||||
|
$table->boolean('is_mandatory')->default(false);
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
$table->foreign('account_type_id')
|
$table->foreign('account_type_id')
|
||||||
->references('id')
|
->references('id')
|
||||||
->on('customer_account_types')
|
->on('customer_account_types')
|
||||||
->onDelete('cascade');
|
->onDelete('cascade');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue