AspireCloud/database/migrations/0001_01_01_000000_init.php
Chuck Adams e90cfd5e75
Chuck/dev/reset schema (#155)
* fix: disable telescope for several commands including migrations

* feat: consolidated, rewritten, and simplified migrations

* tweak: enforce use of postgres, our only supported db

* tweak: use text instead of varchar

this is considered best practice in postgres, as there is absolutely no difference between text and varchar.  if a column size limit is critical, the constraint should be added separately.

* refactor: simplify all types, inline and fix ->timestamps()

* refactor: change all jsonb props to computed using Laravel's Attributes

* refactor: do all metadata rewrites on the fly instead of load time
2025-02-01 10:54:57 -07:00

20 lines
607 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void
{
if (Schema::getConnection()->getDriverName() !== 'pgsql') {
throw new RuntimeException('AspireCloud only supports running on Postgres');
}
if (Schema::hasTable('migrations') && DB::table('migrations')->select('id')->exists()) {
throw new RuntimeException('Existing migrations detected -- aborting');
}
}
public function down(): void {}
};