Skip to content

Commit d2437a3

Browse files
committed
Fix migration problems
1 parent e5897ff commit d2437a3

1 file changed

Lines changed: 6 additions & 22 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,28 +101,12 @@ jobs:
101101
psql -p 10563 -U dspace -d dspace -f /tmp/$FNAME &&
102102
psql -p 10563 -U dspace -d dspace -c 'CREATE EXTENSION IF NOT EXISTS pgcrypto;' &&
103103
psql -p 10563 -U dspace -d dspace -c \"
104-
DO \\\$cleanup\\\$
105-
BEGIN
106-
IF EXISTS (SELECT 1 FROM information_schema.tables WHERE LOWER(table_name) = 'epersongroup2eperson') THEN
107-
WITH ranked AS (
108-
SELECT ctid, row_number() OVER (PARTITION BY eperson_group_id, eperson_id ORDER BY ctid) AS rn
109-
FROM epersongroup2eperson
110-
)
111-
DELETE FROM epersongroup2eperson
112-
WHERE ctid IN (SELECT ctid FROM ranked WHERE rn > 1);
113-
114-
IF EXISTS (
115-
SELECT 1 FROM (
116-
SELECT eperson_group_id, eperson_id, COUNT(*)
117-
FROM epersongroup2eperson
118-
GROUP BY eperson_group_id, eperson_id
119-
HAVING COUNT(*) > 1
120-
) remaining_dups
121-
) THEN
122-
RAISE EXCEPTION 'Failed to clean duplicates from epersongroup2eperson';
123-
END IF;
124-
END IF;
125-
END \\\$cleanup\\\$;
104+
WITH ranked AS (
105+
SELECT ctid, row_number() OVER (PARTITION BY eperson_group_id, eperson_id ORDER BY ctid) AS rn
106+
FROM epersongroup2eperson
107+
)
108+
DELETE FROM epersongroup2eperson
109+
WHERE ctid IN (SELECT ctid FROM ranked WHERE rn > 1);
126110
\" &&
127111
rm /tmp/$FNAME
128112
"

0 commit comments

Comments
 (0)