$t->unsignedBigInteger('owner_user_id')->nullable()->unique()); } if (Schema::hasTable('agent_applications')) return; Schema::create('agent_applications', function (Blueprint $t) { $t->id(); $t->unsignedBigInteger('user_id')->index(); $t->string('username', 64); $t->unsignedBigInteger('pending_user_id')->nullable()->unique(); $t->string('pending_username', 64)->nullable()->unique(); $t->string('password_hash')->nullable(); $t->string('withdraw_password_hash')->nullable(); $t->string('status', 16)->default('pending')->index(); $t->unsignedBigInteger('agent_id')->nullable()->unique(); $t->string('reject_reason', 500)->default(''); $t->unsignedBigInteger('reviewed_by')->nullable(); $t->dateTime('reviewed_at')->nullable(); $t->timestamps(); }); } public function down(): void { // Keep reviewed identity links and application history on a code rollback. } };