Don't include old ssh keys when new ones exist
authorMagnus Hagander <magnus@hagander.net>
Tue, 21 Aug 2012 10:17:21 +0000 (12:17 +0200)
committerMagnus Hagander <magnus@hagander.net>
Tue, 21 Aug 2012 10:17:21 +0000 (12:17 +0200)
This would cause a UNIQUE violation on the git server...

sql/community_login.sql

index cc4bb6a01a9ec27b0326d50aa62400345cc37ec0..fffe79f2241e2fcb44ee8775c7b4832a190eab2e 100644 (file)
@@ -161,4 +161,6 @@ CREATE OR REPLACE VIEW users_keys AS
           users_old.sshkey_last_update
     FROM users_old
     WHERE users_old.sshkey IS NOT NULL
-    AND users_old.sshkey <> ''::text;
+    AND users_old.sshkey <> ''::text
+    AND NOT EXISTS (SELECT * FROM auth_user a WHERE a.username=users_old.userid)
+;