id(); $table->foreignId('owner_id')->constrained('users')->cascadeOnDelete(); $table->string('name', 64)->unique(); $table->string('tag', 6)->unique(); $table->string('logo_url')->nullable(); $table->string('invite_code', 16)->unique(); $table->string('description', 500)->nullable(); $table->unsignedInteger('points')->default(0); $table->unsignedInteger('members_count')->default(0); $table->timestamps(); $table->index(['owner_id']); $table->index(['points', 'members_count']); }); // --------------------------------------------------------------- // GUILD MEMBERS // --------------------------------------------------------------- Schema::create('guild_members', function (Blueprint $table) { $table->id(); $table->foreignId('guild_id')->constrained('guilds')->cascadeOnDelete(); $table->foreignId('user_id')->constrained('users')->cascadeOnDelete(); $table->string('role', 16)->default('member'); // owner | officer | member $table->timestamp('joined_at')->nullable(); $table->timestamps(); $table->unique(['guild_id', 'user_id']); $table->index('user_id'); }); } public function down(): void { Schema::dropIfExists('guild_members'); Schema::dropIfExists('guilds'); } };