Files
fewo-stommer/database/migrations/2026_11_06_100000_create_case_facts.php
T
LarsandClaude Opus 5.5 ccac78a6c9 v0.11 U2: Angebots-Gate, gemeinsamer Fakteneingang mit Herkunft
- CaseRequirements: Vor einem eigenen verbindlichen Angebot und vor der
  verbindlichen Bestätigung eines Buchungswunsches müssen Vor- und
  Nachname, E-Mail, vollständige Anschrift mit Land, Personenzahl und
  Zeitraum vorliegen – harter Blocker, auch von Hand (G2a, B3). Die
  Auskunft unter Vorbehalt bleibt ohne dieses Gate.
- ContributeCaseFacts (S5): jede Angabe mit Herkunft und Ergebnis in
  case_facts; fehlend → übernommen, gleich → bestätigt, abweichend vom
  Gast → Prüfaufgabe (Kartei bleibt), Vermieterin maßgeblich, Zeitraum und
  Personen → Änderungswunsch; idempotent; danach einmal CaseAutomation.
- ProvideGuestContact und Webformular nutzen den Fakteneingang.
- Land als ISO-Code mit „Deutschland“ als änderbarem Formularstandard;
  guests.country ohne stillen Standardwert (B4).
- Testdaten bestehender Tests um Anschriften ergänzt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 13:07:18 +01:00

61 lines
2.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Prozessarchitektur v0.11, common fact intake (S5, CH-03): every detail that arrives for a case – from the website
* form, the guest's link, an e-mail, a portal mail, the extraction or the landlord – is recorded with its source and
* what became of it (taken over, confirmed, conflict, change request, rejected). The data itself stays in guests and
* bookings; this is the evidence. Bookings get the purpose of their hold (offer as before, or clarification).
*/
return new class extends Migration
{
public function up(): void
{
Schema::create('case_facts', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->nullable()->constrained()->cascadeOnDelete();
$table->foreignId('booking_id')->constrained()->cascadeOnDelete();
$table->string('field', 60);
$table->text('value')->nullable();
$table->text('previous_value')->nullable();
$table->string('source', 30);
$table->unsignedBigInteger('inbound_message_id')->nullable()->index();
$table->text('evidence')->nullable();
$table->decimal('confidence', 4, 3)->nullable();
$table->string('outcome', 20);
$table->string('fingerprint', 64);
$table->string('actor')->nullable();
$table->dateTime('created_at');
$table->index(['booking_id', 'field']);
$table->index(['booking_id', 'fingerprint']);
});
Schema::table('bookings', function (Blueprint $table) {
$table->string('hold_purpose', 20)->default('offer')->after('hold_expires_at');
});
// B4: the country is never assumed. New guests have none until a source names it (existing values stay, they
// cannot be told apart from confirmed ones).
Schema::table('guests', function (Blueprint $table) {
$table->string('country', 2)->nullable()->default(null)->change();
});
}
public function down(): void
{
Schema::table('guests', function (Blueprint $table) {
$table->string('country', 2)->default('DE')->change();
});
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('hold_purpose');
});
Schema::dropIfExists('case_facts');
}
};