- Add database migrations for market_listings, missions and character cosmetics - Create controllers for marketplace, missions, presence and character customization - Implement admin world dashboard with live platform metrics - Add feature tests for world functionality - Include phase 2 design documents and gap analysis
54 lines
1.8 KiB
PHP
Executable File
54 lines
1.8 KiB
PHP
Executable File
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
/**
|
|
* Lightweight citizen missions (daily journal goals).
|
|
*
|
|
* Tracks progress per character and pays a money reward on completion.
|
|
*/
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
Schema::create('missions', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->foreignId('city_id')->constrained('cities')->cascadeOnDelete();
|
|
$table->string('code', 60)->unique();
|
|
$table->string('title', 160);
|
|
$table->string('description', 400);
|
|
$table->string('metric', 40); // exercise_count|buildings|transactions|education
|
|
$table->unsignedInteger('target')->default(1);
|
|
$table->decimal('reward', 10, 2)->default(20);
|
|
$table->boolean('is_active')->default(true)->index();
|
|
$table->timestamps();
|
|
});
|
|
|
|
Schema::create('character_missions', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->foreignId('character_id')->constrained('characters')->cascadeOnDelete();
|
|
$table->foreignId('mission_id')->constrained('missions')->cascadeOnDelete();
|
|
$table->unsignedInteger('progress')->default(0);
|
|
$table->boolean('is_completed')->default(false)->index();
|
|
$table->timestamp('completed_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->unique(['character_id', 'mission_id']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('character_missions');
|
|
Schema::dropIfExists('missions');
|
|
}
|
|
};
|