incr/database/migrations/2026_08_16_000000_create_trackers_table.php
myrmidex 68ed294b82
Some checks failed
CI / ci (push) Failing after 1s
CI / build (push) Failing after 27s
Build and Push CI Image / images (docker/build/Dockerfile.ci, incr-ci, php8.3-3) (push) Successful in 7m6s
CI / ci (pull_request) Failing after 1m17s
CI / build (pull_request) Failing after 34s
46 - Squash migrations and run CI against sqlite
2026-08-16 10:38:00 +02:00

37 lines
1 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Consolidates the thirteen migrations that preceded v0.4.0. Those created and
* then dropped assets, users, sessions, milestones and entries to arrive at a
* single table; replaying that chain required MySQL-specific DDL. Deployments
* migrated before this have the old entries in their migrations table and skip
* it via the guard below.
*/
return new class extends Migration
{
public function up(): void
{
if (Schema::hasTable('trackers')) {
return;
}
Schema::create('trackers', function (Blueprint $table): void {
$table->id();
$table->string('label');
$table->string('unit');
$table->unsignedInteger('count')->default(0);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('trackers');
}
};