Files
mareike/database/migrations/2026_08_27_150010_create_document_templates.php

37 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
/**
* Vorlage für generierte Dokumente (aktuell: Anmelde-Rechnung), zerlegt in einzeln pflegbare Blöcke.
*
* Bewusst app-weit und ohne Tenant-Spalte (Model erbt `CommonModel`, also kein `SiteScope`) -- es gibt
* eine Vorlage für alle Tenants, tenant-spezifisch sind nur die eingesetzten Werte. Vorbild ist
* `page_texts`.
*
* Der Inhalt liegt in der Datenbank statt im Blade, damit ein Release ihn nicht überschreibt.
*/
return new class extends Migration {
public function up(): void
{
Schema::create('document_templates', function (Blueprint $table) {
$table->id();
$table->string('document_type');
$table->string('block');
$table->longText('content')->nullable();
$table->integer('sort_order')->default(1);
$table->boolean('editable')->default(true);
$table->timestamps();
$table->unique(['document_type', 'block']);
});
}
public function down(): void
{
Schema::dropIfExists('document_templates');
}
};