Commits

jbe  committed 74c985b

Function "delete_member_data"(...) deletes outgoing delegations
(v1.0.1 with update script)

  • Participants
  • Parent commits 8ad88d4
  • Tags v1.0.1

Comments (0)

Files changed (2)

 BEGIN;
 
 CREATE VIEW "liquid_feedback_version" AS
-  SELECT * FROM (VALUES ('1.0.0', 1, 0, 0))
+  SELECT * FROM (VALUES ('1.0.1', 1, 0, 1))
   AS "subquery"("string", "major", "minor", "revision");
 
 
       DELETE FROM "member_relation_setting" WHERE "member_id" = "member_id_p";
       DELETE FROM "member_image"       WHERE "member_id" = "member_id_p";
       DELETE FROM "contact"            WHERE "member_id" = "member_id_p";
+      DELETE FROM "delegation"         WHERE "truster_id" = "member_id_p";
       DELETE FROM "area_setting"       WHERE "member_id" = "member_id_p";
       DELETE FROM "issue_setting"      WHERE "member_id" = "member_id_p";
       DELETE FROM "initiative_setting" WHERE "member_id" = "member_id_p";

File update/core-update.v1.0.0-v1.0.1.sql

+BEGIN;
+
+CREATE OR REPLACE VIEW "liquid_feedback_version" AS
+  SELECT * FROM (VALUES ('1.0.1', 1, 0, 1))
+  AS "subquery"("string", "major", "minor", "revision");
+ 
+CREATE OR REPLACE FUNCTION "delete_member_data"("member_id_p" "member"."id"%TYPE)
+  RETURNS VOID
+  LANGUAGE 'plpgsql' VOLATILE AS $$
+    BEGIN
+      UPDATE "member" SET
+        "login"                        = NULL,
+        "password"                     = NULL,
+        "notify_email"                 = NULL,
+        "notify_email_unconfirmed"     = NULL,
+        "notify_email_secret"          = NULL,
+        "notify_email_secret_expiry"   = NULL,
+        "password_reset_secret"        = NULL,
+        "password_reset_secret_expiry" = NULL,
+        "organizational_unit"          = NULL,
+        "internal_posts"               = NULL,
+        "realname"                     = NULL,
+        "birthday"                     = NULL,
+        "address"                      = NULL,
+        "email"                        = NULL,
+        "xmpp_address"                 = NULL,
+        "website"                      = NULL,
+        "phone"                        = NULL,
+        "mobile_phone"                 = NULL,
+        "profession"                   = NULL,
+        "external_memberships"         = NULL,
+        "external_posts"               = NULL,
+        "statement"                    = NULL
+        WHERE "id" = "member_id_p";
+      -- "text_search_data" is updated by triggers
+      UPDATE "member_history" SET "login" = NULL
+        WHERE "member_id" = "member_id_p";
+      DELETE FROM "setting"            WHERE "member_id" = "member_id_p";
+      DELETE FROM "setting_map"        WHERE "member_id" = "member_id_p";
+      DELETE FROM "member_relation_setting" WHERE "member_id" = "member_id_p";
+      DELETE FROM "member_image"       WHERE "member_id" = "member_id_p";
+      DELETE FROM "contact"            WHERE "member_id" = "member_id_p";
+      DELETE FROM "delegation"         WHERE "truster_id" = "member_id_p";
+      DELETE FROM "area_setting"       WHERE "member_id" = "member_id_p";
+      DELETE FROM "issue_setting"      WHERE "member_id" = "member_id_p";
+      DELETE FROM "initiative_setting" WHERE "member_id" = "member_id_p";
+      DELETE FROM "suggestion_setting" WHERE "member_id" = "member_id_p";
+      RETURN;
+    END;
+  $$;
+
+COMMIT;