fix(cities): perbaiki pemetaan kolom untuk tabel kota

- Menambahkan indeks pada kolom 'code' untuk meningkatkan performa pencarian.
- Menghapus indeks yang tidak diperlukan untuk kolom 'province_code'.
This commit is contained in:
Daeng Deni Mardaeni
2025-04-27 16:40:13 +07:00
parent 4cf14d46b4
commit 80e592c639
3 changed files with 3 additions and 16 deletions

View File

@@ -14,17 +14,13 @@ return new class extends Migration
Schema::create('cities', function (Blueprint $table) { Schema::create('cities', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('province_code')->index(); $table->string('province_code')->index();
$table->string('code'); $table->string('code')->index();
$table->string('name'); $table->string('name');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->uuid('created_by')->nullable(); $table->uuid('created_by')->nullable();
$table->uuid('updated_by')->nullable(); $table->uuid('updated_by')->nullable();
$table->uuid('deleted_by')->nullable(); $table->uuid('deleted_by')->nullable();
$table->index('code');
$table->index('province_code');
}); });
} }

View File

@@ -15,17 +15,13 @@ return new class extends Migration
$table->id(); $table->id();
$table->string('province_code')->index(); $table->string('province_code')->index();
$table->string('city_code')->index(); $table->string('city_code')->index();
$table->string('code'); $table->string('code')->index();
$table->string('name'); $table->string('name');
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->uuid('created_by')->nullable(); $table->uuid('created_by')->nullable();
$table->uuid('updated_by')->nullable(); $table->uuid('updated_by')->nullable();
$table->uuid('deleted_by')->nullable(); $table->uuid('deleted_by')->nullable();
$table->index('code');
$table->index('province_code');
$table->index('city_code');
}); });
} }

View File

@@ -16,7 +16,7 @@ return new class extends Migration
$table->string('province_code')->index(); $table->string('province_code')->index();
$table->string('city_code')->index(); $table->string('city_code')->index();
$table->string('district_code')->index(); $table->string('district_code')->index();
$table->string('code'); $table->string('code')->index();
$table->string('name'); $table->string('name');
$table->string('alt_name')->nullable(); $table->string('alt_name')->nullable();
$table->string('postal_code', 5)->nullable(); $table->string('postal_code', 5)->nullable();
@@ -25,11 +25,6 @@ return new class extends Migration
$table->uuid('created_by')->nullable(); $table->uuid('created_by')->nullable();
$table->uuid('updated_by')->nullable(); $table->uuid('updated_by')->nullable();
$table->uuid('deleted_by')->nullable(); $table->uuid('deleted_by')->nullable();
$table->index('code');
$table->index('province_code');
$table->index('city_code');
$table->index('district_code');
}); });
} }