Files
fewo-stommer/database/migrations/2026_10_30_171500_create_contract_annexes.php
LarsandClaude Sonnet 5.5 0c4187edaf
Deploy FeWo mit PipelineManager / deploy (push) Successful in 3m34s
Stornoregeln mit automatischer Kostenberechnung, Storno-Verwaltung, Vertragsanlagen
- Stornoregel (Stufen nach Tagen vor Anreise, Mietpreis oder Gesamtpreis, Ersatzmieter-Gebuehr), je Vertragsvorlage,
  beim Angebot eingefroren, als Platzhalter im Vertrag
- Stornierung (Gast-Link oder Verwaltung) berechnet die Kosten, legt einen Stornofall an; Verwaltung Stornierungen
  mit Vorschlag, Festlegung, Saldo, Abrechnung und Erlass; Gast sieht die Kosten vorab auf der Storno-Seite
- Vertragsanlagen als eigene versionierte Dokumente mit Bedingung (immer, Zusatzleistung, Portal, von Hand),
  je Angebot ausgewaehlt und eingefroren; Zusatzleistungen in der Buchung erfassbar
- FeWo-direkt-Installation legt die Stornoregel aus Paragraf 13 an

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 16:32:48 +01:00

45 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Contract annexes as documents of their own (versioned), attached to templates with a condition
* (always, when an extra service is booked, for a portal, only by hand). Additive.
*/
public function up(): void
{
Schema::create('contract_annexes', function (Blueprint $table) {
$table->id();
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
$table->string('name');
$table->unsignedInteger('version')->default(1);
$table->string('title');
$table->longText('body');
$table->string('condition_type', 12)->default('always');
$table->unsignedBigInteger('condition_id')->nullable();
$table->text('notes')->nullable();
$table->timestamps();
$table->unique(['tenant_id', 'name', 'version']);
});
Schema::table('contract_templates', function (Blueprint $table) {
$table->json('annex_ids')->nullable()->after('cancellation_policy_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('contract_templates', function (Blueprint $table) {
$table->dropColumn('annex_ids');
});
Schema::dropIfExists('contract_annexes');
}
};