From d9f8937835ba7f1a297f928c2f70cc73f1a49b93 Mon Sep 17 00:00:00 2001
From: David Douard <david.douard@sdfa3.org>
Date: Mon, 10 Jul 2023 15:43:15 +0200
Subject: [PATCH] fix the 5->6 upgrade sql script

Need to drop the index of the old checked_partition before recreating
the new one (with the same name); simplest way of doing this is cascade
droping the old checked_partition table before recreating the new index.
---
 swh/scrubber/sql/upgrades/6.sql | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/swh/scrubber/sql/upgrades/6.sql b/swh/scrubber/sql/upgrades/6.sql
index 4d22927..7eb9654 100644
--- a/swh/scrubber/sql/upgrades/6.sql
+++ b/swh/scrubber/sql/upgrades/6.sql
@@ -49,7 +49,7 @@ insert into checked_partition
   from old_checked_partition as CP
   inner join check_config as CC using (datastore, object_type, nb_partitions);
 
+drop table old_checked_partition cascade;
+
 create unique index concurrently checked_partition_pkey on checked_partition(config_id, partition_id);
 alter table checked_partition add primary key using index checked_partition_pkey;
-
-drop table old_checked_partition;
-- 
GitLab