https://github.com/lldap/lldap logo
vimerate - Hello,I'm trying to update lldap t...
# troubleshooting
v
Hello, I'm trying to update
lldap
to
0.6.0
running Postgres - the issue I'm running into is where Postgres doesn't support the
DELETE ... LIMIT
the
migrate_to_v8
function is using. Is there an alternative DML I can run to accomplish the same thing?
Ok, I figured a workaround for this by doing the equivalent de-deuplication manually:
Copy code
sql
BEGIN;
ALTER TABLE lldap.memberships ADD COLUMN id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY;
DELETE FROM lldap.memberships a USING lldap.memberships b WHERE a.id < b.id AND  a.user_id = b.user_id AND a.group_id = b.
group_id;
ALTER TABLE lldap.memberships DROP COLUMN id;
CREATE UNIQUE INDEX "unique-memberships" ON lldap.memberships (user_id, group_id);
UPDATE lldap.metadata SET VERSION = 8;
COMMIT;