Lege das Datenmodell und den Anfrageservice der Kommunikationsverwaltung an
Anliegen, Feldkatalog, Feldgruppen, Anfragevorlagen mit unveränderlichen Fassungen, Anfrage-Einstiege und eingegangene Anfragen. Eine gemeinsame Regelauswertung bedient Besucher, Vorschau und Anfrageservice; Werte nicht mehr relevanter Felder werden verworfen, Anliegen und Auswahlwerte serverseitig geprüft, doppeltes Absenden bleibt eine Anfrage. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9e2d64a4a9
commit
2ee1fc9866
30 files changed
+3380
No files matched your search
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Zentrale Kommunikationsverwaltung (ADR-60): nur neue Tabellen, nichts Bestehendes wird verändert.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('inquiry_issues', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('parent_id')->nullable()->constrained('inquiry_issues')->restrictOnDelete();
|
||||
$table->string('key', 60)->unique();
|
||||
$table->string('label', 120);
|
||||
$table->text('description')->nullable();
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('inquiry_fields', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('key', 60)->unique();
|
||||
$table->string('name', 120);
|
||||
$table->string('label', 200);
|
||||
$table->text('help')->nullable();
|
||||
$table->string('type', 20);
|
||||
$table->json('options')->nullable();
|
||||
$table->json('settings')->nullable();
|
||||
$table->string('purpose', 20)->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('inquiry_field_groups', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('key', 60)->unique();
|
||||
$table->string('name', 120);
|
||||
$table->string('label', 200)->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->json('items');
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('inquiry_templates', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('key', 60)->unique();
|
||||
$table->string('name', 120);
|
||||
$table->text('description')->nullable();
|
||||
$table->json('draft');
|
||||
$table->unsignedBigInteger('published_version_id')->nullable()->index();
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('inquiry_template_versions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('template_id')->constrained('inquiry_templates')->restrictOnDelete();
|
||||
$table->unsignedInteger('version');
|
||||
$table->json('definition');
|
||||
$table->json('source');
|
||||
$table->string('note', 300)->nullable();
|
||||
$table->foreignId('published_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('published_at');
|
||||
$table->unique(['template_id', 'version']);
|
||||
});
|
||||
|
||||
Schema::create('inquiry_entries', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('key', 60)->unique();
|
||||
$table->string('name', 120);
|
||||
$table->foreignId('template_id')->constrained('inquiry_templates')->restrictOnDelete();
|
||||
$table->json('config');
|
||||
$table->json('published_config')->nullable();
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->timestamp('archived_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('inquiries', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('reference', 20)->unique();
|
||||
$table->foreignId('entry_id')->nullable()->constrained('inquiry_entries')->restrictOnDelete();
|
||||
$table->foreignId('template_version_id')->constrained('inquiry_template_versions')->restrictOnDelete();
|
||||
$table->string('submission_token', 64)->unique();
|
||||
$table->string('issue_key', 60)->nullable();
|
||||
$table->string('issue_label', 120)->nullable();
|
||||
$table->string('subissue_key', 60)->nullable();
|
||||
$table->string('subissue_label', 120)->nullable();
|
||||
$table->string('contact_name', 200)->nullable();
|
||||
$table->string('contact_email', 200)->nullable();
|
||||
$table->string('contact_phone', 60)->nullable();
|
||||
$table->string('organisation', 200)->nullable();
|
||||
$table->text('message')->nullable();
|
||||
$table->json('answers');
|
||||
$table->string('source_path', 300)->nullable();
|
||||
$table->string('status', 20)->default('neu')->index();
|
||||
$table->timestamp('notified_at')->nullable();
|
||||
$table->text('notification_error')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index('created_at');
|
||||
});
|
||||
|
||||
Schema::create('inquiry_notes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('inquiry_id')->constrained('inquiries')->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->text('body');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('communication_settings', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->json('recipients');
|
||||
$table->unsignedSmallInteger('retention_months')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('communication_settings');
|
||||
Schema::dropIfExists('inquiry_notes');
|
||||
Schema::dropIfExists('inquiries');
|
||||
Schema::dropIfExists('inquiry_entries');
|
||||
Schema::dropIfExists('inquiry_template_versions');
|
||||
Schema::dropIfExists('inquiry_templates');
|
||||
Schema::dropIfExists('inquiry_field_groups');
|
||||
Schema::dropIfExists('inquiry_fields');
|
||||
Schema::dropIfExists('inquiry_issues');
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user