Neustrukturierung Customer / Lead / Booking Phase 2
This commit is contained in:
parent
313f0dbf4e
commit
6df9c401af
69 changed files with 3809 additions and 374 deletions
|
|
@ -28,19 +28,14 @@ return new class extends Migration
|
|||
$t->id();
|
||||
$t->string('offer_number', 32)->unique();
|
||||
|
||||
$t->foreignId('contact_id')
|
||||
->constrained('contacts')
|
||||
->restrictOnDelete();
|
||||
|
||||
$t->foreignId('inquiry_id')
|
||||
->nullable()
|
||||
->constrained('inquiries')
|
||||
->nullOnDelete();
|
||||
|
||||
$t->foreignId('booking_id')
|
||||
->nullable()
|
||||
->constrained('booking')
|
||||
->nullOnDelete();
|
||||
// FK-Typen MÜSSEN exakt zur Referenz passen.
|
||||
// Die Legacy-Tabellen contacts/inquiries/booking sind aus dem
|
||||
// alten Sequel-Pro-Export mit `bigint` (SIGNED) angelegt; die
|
||||
// users-Tabelle nutzt `int unsigned`. Daher hier explizit
|
||||
// typisieren statt foreignId() (das würde bigint UNSIGNED erzeugen).
|
||||
$t->bigInteger('contact_id');
|
||||
$t->bigInteger('inquiry_id')->nullable();
|
||||
$t->bigInteger('booking_id')->nullable();
|
||||
|
||||
$t->enum('status', [
|
||||
'draft',
|
||||
|
|
@ -54,11 +49,17 @@ return new class extends Migration
|
|||
// FK wird in 2026_04_17_100007 nachträglich gesetzt
|
||||
$t->unsignedBigInteger('current_version_id')->nullable();
|
||||
|
||||
$t->foreignId('created_by')->constrained('users');
|
||||
// users.id ist int unsigned (Legacy)
|
||||
$t->unsignedInteger('created_by');
|
||||
|
||||
$t->timestamps();
|
||||
$t->softDeletes();
|
||||
|
||||
$t->foreign('contact_id')->references('id')->on('contacts')->restrictOnDelete();
|
||||
$t->foreign('inquiry_id')->references('id')->on('inquiries')->nullOnDelete();
|
||||
$t->foreign('booking_id')->references('id')->on('booking')->nullOnDelete();
|
||||
$t->foreign('created_by')->references('id')->on('users');
|
||||
|
||||
$t->index(['status', 'contact_id']);
|
||||
$t->index('inquiry_id');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue