added countries support
This commit is contained in:
@@ -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::create('countries', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->char('alpha2', 2)->unique()->comment('ISO 3166-1 alpha-2 country code.');
|
||||
$table->char('alpha3', 3)->unique()->comment('ISO 3166-1 alpha-3 country code.');
|
||||
$table->char('numeric', 3)->nullable()->unique()->comment('ISO 3166-1 numeric country code.');
|
||||
$table->string('name')->comment('Canonical ISO country name.');
|
||||
$table->string('official_name')->nullable()->comment('Official ISO country name where available.');
|
||||
$table->string('common_name')->nullable()->comment('Common country name where available.');
|
||||
$table->string('display_name')->nullable()->comment('Application-specific display name override.');
|
||||
$table->string('flag_emoji', 16)->nullable()->comment('Regional indicator flag emoji derived from alpha-2 code.');
|
||||
$table->boolean('is_active')->default(true)->index()->comment('Whether this country is available for selection in business workflows.');
|
||||
$table->unsignedInteger('sort_order')->default(0)->index()->comment('Optional UI ordering override.');
|
||||
$table->timestamp('last_synced_at')->nullable()->comment('Last time this row was synced from bundled ISO data.');
|
||||
$table->timestamps();
|
||||
$table->index(['is_active', 'sort_order', 'name']);
|
||||
$table->index(['name']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('countries');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user