feat: Implement morph maps and historical migration
This commit is contained in:
@@ -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']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user