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




