feat: add nerve and gym_sessions migrations
This commit is contained in:
@@ -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');
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user