Ergänze das U1-Fachmodell für Inhalt, Paket und Angebot.
Deploy Test / test (push) Successful in 12s
Deploy Test / deploy (push) Failing after 14s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 08:39:02 +01:00
1 parent 2035c46edd
commit 2ded4b7fad
35 files changed
+2115

No files matched your search

@@ -0,0 +1,268 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('content_elements', function (Blueprint $table) {
$table->id();
$table->string('kind');
$table->string('output_class');
$table->string('working_title');
$table->timestamp('archived_at')->nullable();
$table->timestamps();
});
Schema::create('content_element_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('content_element_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('status');
$table->string('content_hash');
$table->text('body')->nullable();
$table->json('metadata')->nullable();
$table->text('change_note')->nullable();
$table->timestamps();
$table->unique(['content_element_id', 'number']);
});
Schema::create('compositions', function (Blueprint $table) {
$table->id();
$table->string('designation');
$table->timestamp('archived_at')->nullable();
$table->timestamps();
});
Schema::create('composition_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('composition_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('status');
$table->string('members_hash');
$table->string('resolved_hash');
$table->timestamps();
$table->unique(['composition_id', 'number']);
});
Schema::create('composition_members', function (Blueprint $table) {
$table->id();
$table->foreignId('composition_version_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('position');
$table->string('role');
$table->foreignId('content_element_version_id')->nullable()->constrained()->restrictOnDelete();
$table->foreignId('nested_composition_version_id')->nullable()->constrained('composition_versions')->restrictOnDelete();
$table->timestamps();
$table->unique(['composition_version_id', 'position']);
});
Schema::create('compatibility_attestations', function (Blueprint $table) {
$table->id();
$table->foreignId('composition_version_id')->constrained()->cascadeOnDelete();
$table->string('resolved_hash');
$table->foreignId('confirmed_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamp('confirmed_at');
$table->text('note')->nullable();
});
Schema::create('license_articles', function (Blueprint $table) {
$table->id();
$table->string('code')->unique();
$table->string('product_line')->nullable();
$table->foreignId('successor_of_id')->nullable()->constrained('license_articles')->nullOnDelete();
$table->timestamp('archived_at')->nullable();
$table->timestamps();
});
Schema::create('article_releases', function (Blueprint $table) {
$table->id();
$table->foreignId('license_article_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('change_kind')->nullable();
$table->boolean('important')->default(false);
$table->text('classification_note');
$table->string('status');
$table->text('block_reason')->nullable();
$table->foreignId('fallback_release_id')->nullable()->constrained('article_releases')->nullOnDelete();
$table->text('change_note')->nullable();
$table->foreignId('root_element_version_id')->nullable()->constrained('content_element_versions')->restrictOnDelete();
$table->foreignId('root_composition_version_id')->nullable()->constrained('composition_versions')->restrictOnDelete();
$table->timestamps();
$table->unique(['license_article_id', 'number']);
});
Schema::create('release_contents', function (Blueprint $table) {
$table->id();
$table->foreignId('article_release_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('position');
$table->foreignId('content_element_version_id')->constrained()->restrictOnDelete();
$table->string('role');
$table->string('path');
$table->timestamps();
$table->unique(['article_release_id', 'position']);
});
Schema::table('license_articles', function (Blueprint $table) {
$table->foreignId('current_release_id')->nullable()->constrained('article_releases')->nullOnDelete();
});
Schema::create('bundles', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamp('archived_at')->nullable();
$table->timestamps();
});
Schema::create('bundle_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('bundle_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('status');
$table->timestamps();
$table->unique(['bundle_id', 'number']);
});
Schema::create('bundle_items', function (Blueprint $table) {
$table->id();
$table->foreignId('bundle_version_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('position');
$table->foreignId('license_article_id')->nullable()->constrained()->restrictOnDelete();
$table->foreignId('nested_bundle_id')->nullable()->constrained('bundles')->restrictOnDelete();
$table->timestamps();
$table->unique(['bundle_version_id', 'position']);
});
Schema::create('rights_profiles', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
Schema::create('rights_profile_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('rights_profile_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('purpose');
$table->json('capabilities');
$table->json('options');
$table->timestamp('locked_at')->nullable();
$table->timestamps();
$table->unique(['rights_profile_id', 'number']);
});
Schema::create('offers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
Schema::create('offer_versions', function (Blueprint $table) {
$table->id();
$table->foreignId('offer_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('number');
$table->string('status');
$table->unsignedInteger('price_cents')->nullable();
$table->string('tax_class')->nullable();
$table->string('term_rule');
$table->string('update_promise');
$table->boolean('dynamic')->default(false);
$table->string('grant_kind');
$table->string('holder_kind');
$table->timestamp('activated_at')->nullable();
$table->timestamps();
$table->unique(['offer_id', 'number']);
});
Schema::create('offer_lines', function (Blueprint $table) {
$table->id();
$table->foreignId('offer_version_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('position');
$table->foreignId('license_article_id')->nullable()->constrained()->restrictOnDelete();
$table->foreignId('bundle_version_id')->nullable()->constrained()->restrictOnDelete();
$table->foreignId('rights_profile_version_id')->constrained()->restrictOnDelete();
$table->timestamps();
$table->unique(['offer_version_id', 'position']);
});
Schema::create('resolved_scopes', function (Blueprint $table) {
$table->id();
$table->foreignId('offer_version_id')->constrained()->cascadeOnDelete();
$table->foreignId('license_article_id')->constrained()->restrictOnDelete();
$table->foreignId('rights_profile_version_id')->constrained()->restrictOnDelete();
$table->timestamps();
$table->unique(['offer_version_id', 'license_article_id', 'rights_profile_version_id'], 'resolved_scopes_unique');
});
Schema::create('acquisitions', function (Blueprint $table) {
$table->id();
$table->foreignId('party_id')->constrained()->restrictOnDelete();
$table->string('type');
$table->string('reference_type');
$table->unsignedBigInteger('reference_id');
$table->json('conditions')->nullable();
$table->timestamps();
$table->unique(['party_id', 'type', 'reference_type', 'reference_id'], 'acquisitions_holder_source_unique');
});
Schema::create('grants', function (Blueprint $table) {
$table->id();
$table->foreignId('acquisition_id')->constrained()->cascadeOnDelete();
$table->foreignId('license_article_id')->constrained()->restrictOnDelete();
$table->foreignId('rights_profile_version_id')->constrained()->restrictOnDelete();
$table->json('rights_snapshot');
$table->timestamp('valid_from')->nullable();
$table->timestamp('valid_until')->nullable();
$table->foreignId('release_at_grant_id')->nullable()->constrained('article_releases')->nullOnDelete();
$table->string('status');
$table->text('status_reason')->nullable();
$table->timestamps();
$table->unique(
['acquisition_id', 'license_article_id', 'rights_profile_version_id'],
'grants_acquisition_article_rights_unique',
);
});
}
public function down(): void
{
Schema::dropIfExists('grants');
Schema::dropIfExists('acquisitions');
Schema::dropIfExists('resolved_scopes');
Schema::dropIfExists('offer_lines');
Schema::dropIfExists('offer_versions');
Schema::dropIfExists('offers');
Schema::dropIfExists('rights_profile_versions');
Schema::dropIfExists('rights_profiles');
Schema::dropIfExists('bundle_items');
Schema::dropIfExists('bundle_versions');
Schema::dropIfExists('bundles');
Schema::table('license_articles', function (Blueprint $table) {
$table->dropConstrainedForeignId('current_release_id');
});
Schema::dropIfExists('release_contents');
Schema::dropIfExists('article_releases');
Schema::dropIfExists('license_articles');
Schema::dropIfExists('compatibility_attestations');
Schema::dropIfExists('composition_members');
Schema::dropIfExists('composition_versions');
Schema::dropIfExists('compositions');
Schema::dropIfExists('content_element_versions');
Schema::dropIfExists('content_elements');
}
};