Feature #4 : Villages

This commit is contained in:
Daeng Deni Mardaeni
2024-08-10 20:12:04 +07:00
parent f1a1f23b12
commit d73a006ce0
15 changed files with 84312 additions and 7 deletions

View File

@@ -0,0 +1,38 @@
<?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::create('villages', function (Blueprint $table) {
$table->id();
$table->string('province_code')->index();
$table->string('city_code')->index();
$table->string('district_code')->index();
$table->string('code');
$table->string('name');
$table->string('alt_name')->nullable();
$table->string('postal_code', 5)->nullable();
$table->timestamps();
$table->softDeletes();
$table->uuid('created_by')->nullable();
$table->uuid('updated_by')->nullable();
$table->uuid('deleted_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('villages');
}
};

View File

@@ -16,6 +16,7 @@ class LocationDatabaseSeeder extends Seeder
ProvinceSeeder::class,
CitySeeder::class,
DistrictSeeder::class,
VillageSeeder::class,
]);
}
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Modules\Location\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class VillageSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
DB::unprepared(file_get_contents(__DIR__ . '/villages.sql'));
}
}

83467
database/seeders/villages.sql Normal file

File diff suppressed because it is too large Load Diff