Führe Übungen als Fassungen mit Varianten, Verwendung und Mitgliederausgabe ein
CI Feature / test (push) Successful in 3m32s
CI Feature / test (push) Successful in 3m32s
Neuer kind 'exercise', Varianten je Fassung, Verwendung (erforderlich/ergänzend) und Variantenauswahl am einbindenden Mitglied; der Stand schreibt nur gewählte Varianten fest. Änderungsnachweis über structure_hash. Formatierte Anleitung im Mitgliederbereich und PDF (Fußzeile, Metadaten, Ausgabenachweis, keine gespeicherten Kopien); Sperre trifft nur das Medium. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ef56befc0e
commit
d1f97a351a
26 files changed
+1628
-15
No files matched your search
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Übungsverwaltung, rein additiv. Alle neuen Spalten sind nullable oder haben einen Vorgabewert. Der Rückfall auf den
|
||||
* vorherigen Programmstand setzt nur den Code zurück: Dieser kennt die Spalten nicht, liest Übungen wegen des
|
||||
* Bereichsfilters am Modell (SupportedKindScope) nicht und verweigert das Veröffentlichen von Aufbauten mit Übungen.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('composition_versions', function (Blueprint $table) {
|
||||
$table->unsignedInteger('duration_max')->nullable();
|
||||
$table->text('prerequisites')->nullable();
|
||||
// Änderungsnachweis über Felder, Varianten und Verwendungen; resolved_hash deckt nur die Medienmenge ab.
|
||||
$table->string('structure_hash')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('compatibility_attestations', function (Blueprint $table) {
|
||||
$table->string('structure_hash')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('composition_version_variants', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('composition_version_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('key');
|
||||
$table->unsignedInteger('position');
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['composition_version_id', 'key']);
|
||||
$table->unique(['composition_version_id', 'position']);
|
||||
});
|
||||
|
||||
Schema::table('composition_members', function (Blueprint $table) {
|
||||
$table->foreignId('variant_id')->nullable()->constrained('composition_version_variants')->restrictOnDelete();
|
||||
$table->string('requirement')->default('erforderlich');
|
||||
$table->json('variant_selection')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('release_contents', function (Blueprint $table) {
|
||||
$table->string('requirement')->nullable();
|
||||
$table->string('variant_key')->nullable();
|
||||
});
|
||||
|
||||
Schema::table('media_deliveries', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('composition_version_id')->nullable();
|
||||
});
|
||||
|
||||
$now = now();
|
||||
DB::table('editorial_content_kinds')->insertOrIgnore([
|
||||
'slug' => 'uebung',
|
||||
'label' => 'Übung',
|
||||
'sort_order' => 25,
|
||||
'is_active' => true,
|
||||
'contexts' => json_encode(['uebung', 'lizenzartikel']),
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('editorial_content_kinds')->where('slug', 'uebung')->delete();
|
||||
|
||||
Schema::table('media_deliveries', function (Blueprint $table) {
|
||||
$table->dropColumn('composition_version_id');
|
||||
});
|
||||
Schema::table('release_contents', function (Blueprint $table) {
|
||||
$table->dropColumn(['requirement', 'variant_key']);
|
||||
});
|
||||
Schema::table('composition_members', function (Blueprint $table) {
|
||||
$table->dropConstrainedForeignId('variant_id');
|
||||
$table->dropColumn(['requirement', 'variant_selection']);
|
||||
});
|
||||
Schema::dropIfExists('composition_version_variants');
|
||||
Schema::table('compatibility_attestations', function (Blueprint $table) {
|
||||
$table->dropColumn('structure_hash');
|
||||
});
|
||||
Schema::table('composition_versions', function (Blueprint $table) {
|
||||
$table->dropColumn(['duration_max', 'prerequisites', 'structure_hash']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user