Revert to original migration

This commit is contained in:
DariusIII
2026-01-23 16:15:35 +01:00
parent ff78a8c8de
commit 20464af1ef
@@ -1,7 +1,7 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
@@ -11,21 +11,25 @@ return new class extends Migration
*/
public function up(): void
{
// Use raw SQL to ensure exact column type matching with existing tables
DB::statement('
CREATE TABLE `user_excluded_categories` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`users_id` int(10) unsigned NOT NULL,
`categories_id` int(10) unsigned NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ux_user_excluded_categories` (`users_id`, `categories_id`),
KEY `ix_user_excluded_categories_users_id` (`users_id`),
CONSTRAINT `FK_uec_users` FOREIGN KEY (`users_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_uec_categories` FOREIGN KEY (`categories_id`) REFERENCES `categories` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
');
Schema::create('user_excluded_categories', function (Blueprint $table) {
$table->id();
$table->unsignedInteger('users_id');
$table->unsignedInteger('categories_id');
$table->timestamps();
$table->foreign('users_id')
->references('id')
->on('users')
->onDelete('cascade');
$table->foreign('categories_id')
->references('id')
->on('categories')
->onDelete('cascade');
$table->unique(['users_id', 'categories_id']);
$table->index('users_id');
});
}
/**