36 lines
966 B
PHP
36 lines
966 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('cooldowns', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->foreignId('character_id')->constrained('characters')->onDelete('cascade');
|
|
$table->string('action_type'); // attack, crime, travel, train, etc.
|
|
$table->timestamp('last_action_at')->useCurrent();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['character_id', 'action_type']);
|
|
$table->index('character_id');
|
|
$table->index('action_type');
|
|
$table->index('last_action_at');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('cooldowns');
|
|
}
|
|
};
|