
jbe@38: BEGIN;
jbe@38: 
jbe@38: CREATE OR REPLACE VIEW "liquid_feedback_version" AS
jbe@38:   SELECT * FROM (VALUES ('beta24', NULL, NULL, NULL))
jbe@38:   AS "subquery"("string", "major", "minor", "revision");
jbe@38: 
jbe@38: COMMENT ON TABLE "setting" IS 'Place to store a frontend specific setting for members as a string';
jbe@38: 
jbe@38: COMMENT ON TABLE "member_relation_setting" IS 'Place to store a frontend specific setting related to relations between members as a string';
jbe@38: 
jbe@38: CREATE OR REPLACE FUNCTION "delete_private_data"()
jbe@38:   RETURNS VOID
jbe@38:   LANGUAGE 'plpgsql' VOLATILE AS $$
jbe@38:     DECLARE
jbe@38:       "issue_id_v" "issue"."id"%TYPE;
jbe@38:     BEGIN
jbe@38:       UPDATE "member" SET
jbe@38:         "login"                        = 'login' || "id"::text,
jbe@38:         "password"                     = NULL,
jbe@38:         "notify_email"                 = NULL,
jbe@38:         "notify_email_unconfirmed"     = NULL,
jbe@38:         "notify_email_secret"          = NULL,
jbe@38:         "notify_email_secret_expiry"   = NULL,
jbe@38:         "password_reset_secret"        = NULL,
jbe@38:         "password_reset_secret_expiry" = NULL,
jbe@38:         "organizational_unit"          = NULL,
jbe@38:         "internal_posts"               = NULL,
jbe@38:         "realname"                     = NULL,
jbe@38:         "birthday"                     = NULL,
jbe@38:         "address"                      = NULL,
jbe@38:         "email"                        = NULL,
jbe@38:         "xmpp_address"                 = NULL,
jbe@38:         "website"                      = NULL,
jbe@38:         "phone"                        = NULL,
jbe@38:         "mobile_phone"                 = NULL,
jbe@38:         "profession"                   = NULL,
jbe@38:         "external_memberships"         = NULL,
jbe@38:         "external_posts"               = NULL,
jbe@38:         "statement"                    = NULL;
jbe@38:       -- "text_search_data" is updated by triggers
jbe@38:       UPDATE "member_history" SET "login" = 'login' || "member_id"::text;
jbe@38:       DELETE FROM "invite_code";
jbe@38:       DELETE FROM "setting";
jbe@38:       DELETE FROM "setting_map";
jbe@38:       DELETE FROM "member_relation_setting";
jbe@38:       DELETE FROM "member_image";
jbe@38:       DELETE FROM "contact";
jbe@38:       DELETE FROM "session";
jbe@38:       DELETE FROM "area_setting";
jbe@38:       DELETE FROM "issue_setting";
jbe@38:       DELETE FROM "initiative_setting";
jbe@38:       DELETE FROM "suggestion_setting";
jbe@38:       DELETE FROM "direct_voter" USING "issue"
jbe@38:         WHERE "direct_voter"."issue_id" = "issue"."id"
jbe@38:         AND "issue"."closed" ISNULL;
jbe@38:       RETURN;
jbe@38:     END;
jbe@38:   $$;
jbe@38: 
jbe@38: COMMIT;




