id(); $table->string('ulid', 26)->unique(); $table->foreignId('workspace_id')->constrained()->cascadeOnDelete(); $table->foreignId('domain_id')->nullable()->constrained()->nullOnDelete(); $table->string('slug', 64); $table->text('target_url'); $table->string('title')->nullable(); $table->text('description')->nullable(); $table->string('favicon_url')->nullable(); $table->enum('status', ['active', 'disabled', 'expired'])->default('active'); $table->string('password', 255)->nullable(); $table->timestamp('expires_at')->nullable(); $table->unsignedBigInteger('click_limit')->nullable(); $table->json('rules')->nullable(); $table->json('pixel_config')->nullable(); $table->json('tags')->nullable(); $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); $table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete(); $table->softDeletes(); $table->timestamps(); $table->unique(['workspace_id', 'domain_id', 'slug'], 'links_workspace_domain_slug_unique'); $table->index('workspace_id'); $table->index('status'); }); } public function down(): void { Schema::dropIfExists('links'); } };