This commit is contained in:
baodev0
2026-08-28 16:40:40 +07:00
parent c917e3bf5e
commit d3d9f76ba0
20 changed files with 94 additions and 11 deletions
BIN
View File
Binary file not shown.
@@ -33,6 +33,7 @@ return new class extends Migration {
$table->tinyInteger('receive_deposit')->default(1);
$table->string('password')->nullable();
$table->integer('credit')->default(0);
$table->integer('unpaid_total')->default(0);
$table->integer('total')->default(0);
$table->string('identity_number')->nullable();
$table->string('front_identity_number')->nullable();
@@ -44,15 +45,9 @@ return new class extends Migration {
$table->timestamps();
$table->softDeletes();
$table->foreign('province_code')
->references('code')
->on('provinces')
->onDelete('set null');
$table->foreign('province_code')->references('code')->on('provinces')->onDelete('set null');
$table->foreign('ward_code')
->references('code')
->on('wards')
->onDelete('set null');
$table->foreign('ward_code')->references('code')->on('wards')->onDelete('set null');
$table->index('province_code', 'idx_users_province');
$table->index('ward_code', 'idx_users_ward');
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
Schema::table('orders', function (Blueprint $table) {
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
});
Schema::table('invoices', function (Blueprint $table) {
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
});
Schema::table('order_items', function (Blueprint $table) {
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
});
Schema::table('invoice_items', function (Blueprint $table) {
$table->unsignedBigInteger('legacy_id')->nullable()->unique()->after('id');
});
}
public function down(): void
{
Schema::table('orders', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
Schema::table('invoices', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
Schema::table('order_items', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
Schema::table('invoice_items', fn (Blueprint $t) => $t->dropColumn('legacy_id'));
}
};
@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
// Multiple legitimate customers can share one phone (agency/accountant managing
// several company accounts on one contact number) — WHMCS data confirmed this
// isn't dirty data, so uniqueness here was the wrong constraint.
return new class extends Migration {
public function up(): void
{
Schema::table('customers', function (Blueprint $table) {
$table->dropUnique('customers_phone_unique');
$table->index('phone');
});
}
public function down(): void
{
Schema::table('customers', function (Blueprint $table) {
$table->dropIndex(['phone']);
$table->unique('phone');
});
}
};
@@ -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('customers', function (Blueprint $table) {
//
$table->integer('unpaid_total')->default(0)->comment('Số nợ còn thiếu')->after('total');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('customers', function (Blueprint $table) {
//
});
}
};