update ippool

This commit is contained in:
baodev0
2026-08-06 11:13:42 +07:00
parent 520f21cb11
commit a5e342f0f5
6 changed files with 271 additions and 1 deletions
@@ -0,0 +1,51 @@
<?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('ip_pools', function (Blueprint $table) {
// gateway, cidr, netmask, status already exist on this table
$table->string('owner_type')->nullable()->after('module_network_id');
$table->string('ip_role')->nullable()->after('owner_type');
$table->string('parent_ip')->nullable()->after('ip_role');
$table->string('customer_name')->nullable()->after('parent_ip');
$table->string('service_name')->nullable()->after('customer_name');
$table->date('allocated_at')->nullable()->after('service_name');
$table->date('revoked_at')->nullable()->after('allocated_at');
$table->string('allocation_status')->nullable()->after('revoked_at');
$table->string('contact_email')->nullable()->after('allocation_status');
$table->string('contact_cc')->nullable()->after('contact_email');
$table->string('contact_phone')->nullable()->after('contact_cc');
$table->decimal('monthly_cost', 14, 2)->nullable()->after('contact_phone');
$table->decimal('selling_price', 14, 2)->nullable()->after('monthly_cost');
$table->text('additional_info')->nullable()->after('selling_price');
$table->string('last_email_type')->nullable()->after('additional_info');
$table->dateTime('last_email_at')->nullable()->after('last_email_type');
$table->string('updated_by')->nullable()->after('last_email_at');
$table->text('note')->nullable()->after('updated_by');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ip_pools', function (Blueprint $table) {
$table->dropColumn([
'owner_type', 'ip_role', 'parent_ip',
'customer_name', 'service_name', 'allocated_at', 'revoked_at', 'allocation_status',
'contact_email', 'contact_cc', 'contact_phone', 'monthly_cost', 'selling_price',
'additional_info', 'last_email_type', 'last_email_at', 'updated_by', 'note',
]);
});
}
};
@@ -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('ip_pools', function (Blueprint $table) {
$table->unique(['ip_address', 'module_network_id'], 'ip_pools_ip_network_unique');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ip_pools', function (Blueprint $table) {
$table->dropUnique('ip_pools_ip_network_unique');
});
}
};