Live Show data model + workflow
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-05 12:31:54 +01:00
parent c07687102e
commit 4718998e07
6 changed files with 317 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('events', function (Blueprint $table) {
if (! Schema::hasColumn('events', 'live_show_token')) {
$table->string('live_show_token', 96)
->nullable()
->after('settings');
$table->unique('live_show_token', 'events_live_show_token_unique');
}
if (! Schema::hasColumn('events', 'live_show_token_rotated_at')) {
$table->timestamp('live_show_token_rotated_at')
->nullable()
->after('live_show_token');
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('events', function (Blueprint $table) {
if (Schema::hasColumn('events', 'live_show_token')) {
$table->dropUnique('events_live_show_token_unique');
$table->dropColumn('live_show_token');
}
if (Schema::hasColumn('events', 'live_show_token_rotated_at')) {
$table->dropColumn('live_show_token_rotated_at');
}
});
}
};

View File

@@ -0,0 +1,102 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('photos', function (Blueprint $table) {
$afterColumn = Schema::hasColumn('photos', 'moderated_by') ? 'moderated_by' : 'status';
if (! Schema::hasColumn('photos', 'live_status')) {
$table->string('live_status', 32)
->default('none')
->after($afterColumn);
$table->index(['event_id', 'live_status'], 'photos_event_live_status_index');
}
if (! Schema::hasColumn('photos', 'live_submitted_at')) {
$table->timestamp('live_submitted_at')
->nullable()
->after('live_status');
}
if (! Schema::hasColumn('photos', 'live_approved_at')) {
$table->timestamp('live_approved_at')
->nullable()
->after('live_submitted_at');
$table->index(['event_id', 'live_status', 'live_approved_at'], 'photos_event_live_approved_index');
}
if (! Schema::hasColumn('photos', 'live_reviewed_at')) {
$table->timestamp('live_reviewed_at')
->nullable()
->after('live_approved_at');
}
if (! Schema::hasColumn('photos', 'live_reviewed_by')) {
$table->foreignId('live_reviewed_by')
->nullable()
->after('live_reviewed_at')
->constrained('users')
->nullOnDelete();
}
if (! Schema::hasColumn('photos', 'live_rejection_reason')) {
$table->string('live_rejection_reason', 64)
->nullable()
->after('live_reviewed_by');
}
if (! Schema::hasColumn('photos', 'live_priority')) {
$table->unsignedSmallInteger('live_priority')
->default(0)
->after('live_rejection_reason');
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('photos', function (Blueprint $table) {
if (Schema::hasColumn('photos', 'live_priority')) {
$table->dropColumn('live_priority');
}
if (Schema::hasColumn('photos', 'live_rejection_reason')) {
$table->dropColumn('live_rejection_reason');
}
if (Schema::hasColumn('photos', 'live_reviewed_by')) {
$table->dropConstrainedForeignId('live_reviewed_by');
}
if (Schema::hasColumn('photos', 'live_reviewed_at')) {
$table->dropColumn('live_reviewed_at');
}
if (Schema::hasColumn('photos', 'live_approved_at')) {
$table->dropIndex('photos_event_live_approved_index');
$table->dropColumn('live_approved_at');
}
if (Schema::hasColumn('photos', 'live_submitted_at')) {
$table->dropColumn('live_submitted_at');
}
if (Schema::hasColumn('photos', 'live_status')) {
$table->dropIndex('photos_event_live_status_index');
$table->dropColumn('live_status');
}
});
}
};