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




