Files
travel/database/migrations/2026_03_06_041215_create_towns_table.php
Tim Basten a37ada96e2
All checks were successful
linter / quality (pull_request) Successful in 1m21s
security / Dependency Audit (pull_request) Successful in 1m25s
security / Static Analysis (pull_request) Successful in 1m49s
tests / ci (8.4) (pull_request) Successful in 1m23s
tests / ci (8.5) (pull_request) Successful in 1m27s
Add nightly town sync from ArcGIS API with autocomplete
- Add towns table with town_pid, town_name, state, population, town_class, date_retired
- Add AustralianState enum with label and abbreviation helpers
- Add Town model with active() and search() scopes
- Add SyncTowns job that paginates ArcGIS API and upserts all 1977 towns
- Schedule SyncTowns to run nightly at 02:00
- Add /towns/search endpoint returning JSON suggestions filtered by name and state
- Add Alpine-powered autocomplete on origin/destination fields in create form
- Add state filter dropdown in journeys card header to narrow autocomplete results
2026-03-06 04:16:55 +00:00

36 lines
917 B
PHP

<?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('towns', function (Blueprint $table) {
$table->id();
$table->string('town_pid', 15)->unique();
$table->string('town_name', 50);
$table->unsignedTinyInteger('state');
$table->unsignedInteger('population')->nullable();
$table->unsignedTinyInteger('town_class')->nullable();
$table->timestamp('date_retired')->nullable();
$table->timestamps();
$table->index(['town_name', 'state']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('towns');
}
};