id(); $table->foreignId('player_id')->constrained()->cascadeOnDelete(); $table->string('quest', 48); $table->dateTime('claimed_at', 3); $table->unique(['player_id', 'quest']); }); // How often a player has done something a quest asks for (Counters::bump). Schema::create('player_counters', function (Blueprint $table) { $table->id(); $table->foreignId('player_id')->constrained()->cascadeOnDelete(); $table->string('key', 48); $table->unsignedInteger('value')->default(0); $table->unique(['player_id', 'key']); }); // A building level reached for the first time pays back part of its cost, once // per player, type and level, into the village it was reached in. Schema::create('level_rewards', function (Blueprint $table) { $table->id(); $table->foreignId('player_id')->constrained()->cascadeOnDelete(); $table->foreignId('village_id')->constrained()->cascadeOnDelete(); $table->string('type', 32); $table->unsignedSmallInteger('level'); $table->json('reward'); $table->dateTime('reached_at', 3); $table->dateTime('claimed_at', 3)->nullable(); $table->unique(['player_id', 'type', 'level']); $table->index(['player_id', 'claimed_at']); }); } public function down(): void { Schema::dropIfExists('level_rewards'); Schema::dropIfExists('player_counters'); Schema::dropIfExists('player_quests'); } };