Fuehre Regeln fuer freie Artikel und Fuer dich im Mitgliederbereich ein
- Regel je Angebot auf Abruf: alle Mitglieder, nur freigeschaltete Konten, wer einen Artikel besitzt - Freigaben je Angebot und Konto (offer_releases), nie geloescht, nur entzogen; Pflege im Angebot - Pruefung serverseitig in GrantIssuer::claim; Angebote bei Registrierung bleiben regelfrei - Mitgliederseite Angebote: Neu fuer dich (neue Staende besessener Artikel), Zum Uebernehmen, Shop - Migration 2026_12_01_110000, ADR-56, DEPLOYMENT.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61c65595e1
commit
95a888d1ca
14 files changed
+1045
-33
No files matched your search
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Regeln für freie Artikel (ADR-56), rein ergänzend: Wer ein Angebot „auf Abruf“ übernehmen darf (alle Mitglieder,
|
||||
* freigeschaltete Konten oder wer einen bestimmten Artikel besitzt) und die Freigaben je Konto. Freigaben werden nie
|
||||
* gelöscht, nur entzogen; ein Angebot oder Konto mit Freigaben lässt sich nicht löschen (restrict).
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('offers', function (Blueprint $table): void {
|
||||
$table->string('claim_access', 20)->default('alle');
|
||||
$table->foreignId('claim_requires_article_id')->nullable()->constrained('license_articles')->restrictOnDelete();
|
||||
});
|
||||
|
||||
Schema::create('offer_releases', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('offer_id')->constrained('offers')->restrictOnDelete();
|
||||
$table->foreignId('user_id')->constrained('users')->restrictOnDelete();
|
||||
$table->foreignId('granted_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('granted_at');
|
||||
$table->timestamp('valid_until')->nullable();
|
||||
$table->foreignId('revoked_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamp('revoked_at')->nullable();
|
||||
$table->text('reason')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index(['offer_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('offer_releases');
|
||||
|
||||
Schema::table('offers', function (Blueprint $table): void {
|
||||
$table->dropConstrainedForeignId('claim_requires_article_id');
|
||||
$table->dropColumn('claim_access');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user