feat: add nerve and gym_sessions migrations

This commit is contained in:
Doar Mihai
2026-06-28 15:47:09 +03:00
parent 457c364738
commit 536269cbb5
4 changed files with 95 additions and 0 deletions
@@ -0,0 +1,24 @@
<?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::table('characters', function (Blueprint $table) {
$table->integer('nerve')->default(100)->after('max_energy');
$table->integer('max_nerve')->default(100)->after('nerve');
$table->timestamp('nerve_regen_at')->nullable()->after('max_nerve');
});
}
public function down(): void
{
Schema::table('characters', function (Blueprint $table) {
$table->dropColumn(['nerve', 'max_nerve', 'nerve_regen_at']);
});
}
};
@@ -0,0 +1,22 @@
<?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::table('crimes', function (Blueprint $table) {
$table->integer('nerve_cost')->default(1)->after('energy_cost');
});
}
public function down(): void
{
Schema::table('crimes', function (Blueprint $table) {
$table->dropColumn('nerve_cost');
});
}
};
@@ -0,0 +1,22 @@
<?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::table('crime_attempts', function (Blueprint $table) {
$table->integer('nerve_cost')->default(1)->after('experience_gained');
});
}
public function down(): void
{
Schema::table('crime_attempts', function (Blueprint $table) {
$table->dropColumn('nerve_cost');
});
}
};
@@ -0,0 +1,27 @@
<?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('gym_sessions', function (Blueprint $table) {
$table->id();
$table->foreignId('character_id')->constrained()->cascadeOnDelete();
$table->enum('stat', ['strength', 'defense', 'speed', 'dexterity']);
$table->integer('sessions_today')->default(0);
$table->date('reset_date');
$table->timestamps();
$table->unique(['character_id', 'stat']);
});
}
public function down(): void
{
Schema::dropIfExists('gym_sessions');
}
};