increments('id'); $table->string('name'); $table->string('record_type')->default('A'); $table->string('cloudflare_id')->nullable(); $table->unsignedInteger('domain_id'); $table->foreign('domain_id')->references('id')->on('cloudflare_domains')->cascadeOnDelete(); $table->unsignedInteger('server_id'); $table->foreign('server_id')->references('id')->on('servers')->cascadeOnDelete(); $table->timestamps(); $table->unique(['name', 'domain_id']); }); } public function down(): void { Subdomain::all()->each(function (Subdomain $subdomain) { try { $subdomain->delete(); } catch (Exception) { } }); Schema::dropIfExists('subdomains'); } };