From c6bf30ba4a75d88c1affd56e2c03df0918f119d6 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Fri, 23 Jan 2026 15:20:26 +0100 Subject: [PATCH] Update migration --- ..._create_user_excluded_categories_table.php | 36 +++++++++---------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/database/migrations/2026_01_23_150053_create_user_excluded_categories_table.php b/database/migrations/2026_01_23_150053_create_user_excluded_categories_table.php index b06c7e821..752e9e0df 100644 --- a/database/migrations/2026_01_23_150053_create_user_excluded_categories_table.php +++ b/database/migrations/2026_01_23_150053_create_user_excluded_categories_table.php @@ -1,7 +1,7 @@ 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'); - }); + // 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 + "); } /**