feat: Implement morph maps and historical migration

This commit is contained in:
Daan Meijer
2026-06-23 11:34:07 +02:00
parent d68fc33bcb
commit 682da3dea8
3 changed files with 42 additions and 4 deletions
@@ -0,0 +1,30 @@
<?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('messages', function (Blueprint $table) {
DB::table('messages')->where('subject_type', 'App\\Models\\User')->update(['subject_type' => 'user']);
DB::table('messages')->where('subject_type', 'App\\Models\\Mutation')->update(['subject_type' => 'mutation']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('messages', function (Blueprint $table) {
DB::table('messages')->where('subject_type', 'user')->update(['subject_type' => 'App\\Models\\User']);
DB::table('messages')->where('subject_type', 'mutation')->update(['subject_type' => 'App\\Models\\Mutation']);
});
}
};