prepared and gallery fixes
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?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('forum_threads', function (Blueprint $table) {
|
||||
// drop existing FK if present
|
||||
try {
|
||||
$table->dropForeign(['category_id']);
|
||||
} catch (\Exception $e) {
|
||||
// ignore if not exists
|
||||
}
|
||||
|
||||
$table->foreign('category_id')->references('id')->on('forum_categories')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('forum_threads', function (Blueprint $table) {
|
||||
try {
|
||||
$table->dropForeign(['category_id']);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
|
||||
$table->foreign('category_id')->references('id')->on('categories')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user