Add fix_legal_revision_user_id migration

This commit is contained in:
dyzulk
2025-12-30 18:29:35 +07:00
parent f68f34980a
commit 452adb936b

View File

@@ -0,0 +1,41 @@
<?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
{
// Fix column type mismatch for created_by (Int -> UUID)
if (Schema::hasColumn('legal_page_revisions', 'created_by')) {
Schema::table('legal_page_revisions', function (Blueprint $table) {
$table->dropColumn('created_by');
});
}
Schema::table('legal_page_revisions', function (Blueprint $table) {
$table->uuid('created_by')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
if (Schema::hasColumn('legal_page_revisions', 'created_by')) {
Schema::table('legal_page_revisions', function (Blueprint $table) {
$table->dropColumn('created_by');
});
}
Schema::table('legal_page_revisions', function (Blueprint $table) {
$table->unsignedBigInteger('created_by')->nullable();
});
}
};