
jbe@228: BEGIN;
jbe@228: 
jbe@228: CREATE OR REPLACE VIEW "liquid_feedback_version" AS
jbe@228:   SELECT * FROM (VALUES ('2.0.5', 2, 0, 5))
jbe@228:   AS "subquery"("string", "major", "minor", "revision");
jbe@228: 
jbe@228: CREATE OR REPLACE FUNCTION "delete_private_data"()
jbe@228:   RETURNS VOID
jbe@228:   LANGUAGE 'plpgsql' VOLATILE AS $$
jbe@228:     BEGIN
jbe@228:       DELETE FROM "member" WHERE "activated" ISNULL;
jbe@228:       UPDATE "member" SET
jbe@228:         "invite_code"                  = NULL,
jbe@228:         "admin_comment"                = NULL,
jbe@228:         "last_login"                   = NULL,
jbe@228:         "login"                        = NULL,
jbe@228:         "password"                     = NULL,
jbe@228:         "notify_email"                 = NULL,
jbe@228:         "notify_email_unconfirmed"     = NULL,
jbe@228:         "notify_email_secret"          = NULL,
jbe@228:         "notify_email_secret_expiry"   = NULL,
jbe@228:         "notify_email_lock_expiry"     = NULL,
jbe@228:         "password_reset_secret"        = NULL,
jbe@228:         "password_reset_secret_expiry" = NULL,
jbe@228:         "organizational_unit"          = NULL,
jbe@228:         "internal_posts"               = NULL,
jbe@228:         "realname"                     = NULL,
jbe@228:         "birthday"                     = NULL,
jbe@228:         "address"                      = NULL,
jbe@228:         "email"                        = NULL,
jbe@228:         "xmpp_address"                 = NULL,
jbe@228:         "website"                      = NULL,
jbe@228:         "phone"                        = NULL,
jbe@228:         "mobile_phone"                 = NULL,
jbe@228:         "profession"                   = NULL,
jbe@228:         "external_memberships"         = NULL,
jbe@228:         "external_posts"               = NULL,
jbe@228:         "statement"                    = NULL;
jbe@228:       -- "text_search_data" is updated by triggers
jbe@228:       DELETE FROM "setting";
jbe@228:       DELETE FROM "setting_map";
jbe@228:       DELETE FROM "member_relation_setting";
jbe@228:       DELETE FROM "member_image";
jbe@228:       DELETE FROM "contact";
jbe@228:       DELETE FROM "ignored_member";
jbe@228:       DELETE FROM "area_setting";
jbe@228:       DELETE FROM "issue_setting";
jbe@228:       DELETE FROM "ignored_initiative";
jbe@228:       DELETE FROM "initiative_setting";
jbe@228:       DELETE FROM "suggestion_setting";
jbe@228:       DELETE FROM "non_voter";
jbe@228:       DELETE FROM "direct_voter" USING "issue"
jbe@228:         WHERE "direct_voter"."issue_id" = "issue"."id"
jbe@228:         AND "issue"."closed" ISNULL;
jbe@228:       RETURN;
jbe@228:     END;
jbe@228:   $$;
jbe@228: 
jbe@228: COMMIT;




