From 7e93219774a624e8c3b84e6d973351b41b0b0620 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 15 Oct 2025 12:05:16 +0200 Subject: [PATCH] fix: allow to re-use a deleted ref in articles --- ..._update_shop_articles_ref_unique_index.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 database/migrations/shop/2025_10_15_120000_update_shop_articles_ref_unique_index.php diff --git a/database/migrations/shop/2025_10_15_120000_update_shop_articles_ref_unique_index.php b/database/migrations/shop/2025_10_15_120000_update_shop_articles_ref_unique_index.php new file mode 100644 index 00000000..a9ce354a --- /dev/null +++ b/database/migrations/shop/2025_10_15_120000_update_shop_articles_ref_unique_index.php @@ -0,0 +1,30 @@ +dropUnique('ref'); + $table->unique(['ref', 'deleted_at'], 'shop_articles_ref_deleted_at_unique'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('shop_articles', function (Blueprint $table) { + $table->dropUnique('shop_articles_ref_deleted_at_unique'); + $table->unique('ref'); + }); + } +};