Feature #4 : Villages
This commit is contained in:
@@ -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');
|
||||
}
|
||||
};
|
||||
@@ -16,6 +16,7 @@ class LocationDatabaseSeeder extends Seeder
|
||||
ProvinceSeeder::class,
|
||||
CitySeeder::class,
|
||||
DistrictSeeder::class,
|
||||
VillageSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
19
database/seeders/VillageSeeder.php
Normal file
19
database/seeders/VillageSeeder.php
Normal 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
83467
database/seeders/villages.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user