From 23682def0d261f5e08b6db0696c55566caaa52ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Wed, 26 Aug 2026 11:19:50 +0200 Subject: [PATCH] refactor(migrations): use RuntimeException for irreversible uuidv7 migrations [AUD-DB-002] --- .../2026_06_06_181952_migrate_products_to_uuidv7.php | 7 ++++++- .../2026_06_06_181953_migrate_orders_to_uuidv7.php | 7 ++++++- .../2026_06_07_072414_migrate_customers_to_uuidv7.php | 7 ++++++- ...51618_migrate_shops_and_pickup_exceptions_to_uuidv7.php | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/database/migrations/2026_06_06_181952_migrate_products_to_uuidv7.php b/database/migrations/2026_06_06_181952_migrate_products_to_uuidv7.php index 70050800..a1faf9d1 100644 --- a/database/migrations/2026_06_06_181952_migrate_products_to_uuidv7.php +++ b/database/migrations/2026_06_06_181952_migrate_products_to_uuidv7.php @@ -39,9 +39,14 @@ return new class () extends Migration Schema::enableForeignKeyConstraints(); } + /** + * @throws \RuntimeException + */ public function down(): void { - throw new \Error('WONT ROLLBACK'); + throw new \RuntimeException( + 'This migration is irreversible: the transformation of products from integer IDs to UUIDv7 cannot be rolled back.' + ); } private function dropForeignKeysForColumn(string $tableName, string $columnName): void diff --git a/database/migrations/2026_06_06_181953_migrate_orders_to_uuidv7.php b/database/migrations/2026_06_06_181953_migrate_orders_to_uuidv7.php index 3bcef9b3..5d3b4594 100644 --- a/database/migrations/2026_06_06_181953_migrate_orders_to_uuidv7.php +++ b/database/migrations/2026_06_06_181953_migrate_orders_to_uuidv7.php @@ -30,9 +30,14 @@ return new class () extends Migration Schema::enableForeignKeyConstraints(); } + /** + * @throws \RuntimeException + */ public function down(): void { - throw new \Error('WONT ROLLBACK'); + throw new \RuntimeException( + 'This migration is irreversible: the transformation of orders from integer IDs to UUIDv7 cannot be rolled back.' + ); } private function dropForeignKeysForColumn(string $tableName, string $columnName): void diff --git a/database/migrations/2026_06_07_072414_migrate_customers_to_uuidv7.php b/database/migrations/2026_06_07_072414_migrate_customers_to_uuidv7.php index 72beef5c..afd3ce7c 100644 --- a/database/migrations/2026_06_07_072414_migrate_customers_to_uuidv7.php +++ b/database/migrations/2026_06_07_072414_migrate_customers_to_uuidv7.php @@ -31,9 +31,14 @@ return new class () extends Migration Schema::enableForeignKeyConstraints(); } + /** + * @throws \RuntimeException + */ public function down(): void { - throw new \Error('WONT ROLLBACK'); + throw new \RuntimeException( + 'This migration is irreversible: the transformation of customers from integer IDs to UUIDv7 cannot be rolled back.' + ); } private function dropForeignKeysForColumn(string $tableName, string $columnName): void diff --git a/database/migrations/2026_06_13_151618_migrate_shops_and_pickup_exceptions_to_uuidv7.php b/database/migrations/2026_06_13_151618_migrate_shops_and_pickup_exceptions_to_uuidv7.php index 73b7695e..87e77644 100644 --- a/database/migrations/2026_06_13_151618_migrate_shops_and_pickup_exceptions_to_uuidv7.php +++ b/database/migrations/2026_06_13_151618_migrate_shops_and_pickup_exceptions_to_uuidv7.php @@ -47,9 +47,14 @@ return new class () extends Migration Schema::enableForeignKeyConstraints(); } + /** + * @throws \RuntimeException + */ public function down(): void { - throw new \Error('WONT ROLLBACK'); + throw new \RuntimeException( + 'This migration is irreversible: the transformation of shops and pickup exceptions from integer IDs to UUIDv7 cannot be rolled back.' + ); } private function dropForeignKeysForColumn(string $tableName, string $columnName): void