46 lines
1.6 KiB
PHP
46 lines
1.6 KiB
PHP
<?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::table('content_elements', function (Blueprint $table) {
|
|
$table->string('display_title')->nullable()->after('working_title');
|
|
$table->text('summary')->nullable()->after('description');
|
|
});
|
|
|
|
Schema::table('compositions', function (Blueprint $table) {
|
|
$table->string('display_title')->nullable()->after('designation');
|
|
$table->text('summary')->nullable()->after('display_title');
|
|
});
|
|
|
|
Schema::create('identity_changes', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('subject_type');
|
|
$table->unsignedBigInteger('subject_id');
|
|
$table->string('field');
|
|
$table->text('before')->nullable();
|
|
$table->text('after')->nullable();
|
|
$table->foreignId('actor_id')->nullable()->constrained('users')->nullOnDelete();
|
|
$table->timestamp('occurred_at');
|
|
$table->timestamps();
|
|
$table->index(['subject_type', 'subject_id']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('identity_changes');
|
|
Schema::table('compositions', function (Blueprint $table) {
|
|
$table->dropColumn(['display_title', 'summary']);
|
|
});
|
|
Schema::table('content_elements', function (Blueprint $table) {
|
|
$table->dropColumn(['display_title', 'summary']);
|
|
});
|
|
}
|
|
};
|