refactor: restrict companies to only one contact

This commit is contained in:
2025-10-21 11:02:13 +02:00
parent 3c45c3f9c9
commit b4f98718e6
2 changed files with 1 additions and 29 deletions

View File

@@ -16,6 +16,7 @@ return new class extends Migration
$table->string("name")->nullable(false)->unique();
$table->string("address")->nullable(false);
$table->unsignedInteger("ico")->nullable(false)->unique();
$table->foreignId("contact")->nullable(false)->constrained("users")->onDelete("cascade");
$table->boolean("hiring")->nullable(false)->default(false);
$table->timestamps();
});

View File

@@ -1,29 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('employers', function (Blueprint $table) {
$table->id();
$table->foreignId("user_id")->nullable(false)->constrained("users")->onDelete("cascade");
$table->foreignId("company_id")->nullable(false)->constrained("companies")->onDelete("cascade");
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('employers');
}
};