string('slug')->primary(); $table->string('name'); $table->timestamps(); }); Schema::create('cost_units', function (Blueprint $table) { $table->id(); $table->string('tenant'); $table->string('name'); $table->string('type'); $table->dateTime('billing_deadline')->nullable(); $table->float('distance_allowance'); $table->boolean('mail_on_new')->default(true); $table->boolean('allow_new')->default(true); $table->boolean('archived')->default(false); $table->foreign('tenant')->references('slug')->on('tenants')->restrictOnDelete()->cascadeOnUpdate(); $table->foreign('type')->references('slug')->on('cost_unit_types')->restrictOnDelete()->cascadeOnUpdate(); $table->timestamps(); }); Schema::create('cost_unit_treasurers', function (Blueprint $table) { $table->id(); $table->foreignId('cost_unit_id')->constrained('cost_units', 'id')->restrictOnDelete()->cascadeOnUpdate(); $table->foreignId('user_id')->constrained('users', 'id')->restrictOnDelete()->cascadeOnUpdate(); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('cost_unit_treasurers'); Schema::dropIfExists('cost_units'); Schema::dropIfExists('cost_unit_types'); } };