From 778303bb6eaad1e125ad2dd3385b6cd7bf255573 Mon Sep 17 00:00:00 2001 From: Dan Farina Date: Tue, 7 Dec 2010 21:30:20 -0800 Subject: [PATCH] Split up install/uninstall actions more like a standard contrib Signed-off-by: Dan Farina Signed-off-by: Peter van Hardenberg --- repmgr.sql | 10 +++++++--- uninstall_repmgr.sql | 13 +++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 uninstall_repmgr.sql diff --git a/repmgr.sql b/repmgr.sql index 42ccfb8f..4a300816 100644 --- a/repmgr.sql +++ b/repmgr.sql @@ -1,3 +1,10 @@ +/* + * repmgr.sql + * + * Copyright (c) Heroku, 2010 + * + */ + CREATE USER repmgr; CREATE SCHEMA repmgr; @@ -5,7 +12,6 @@ CREATE SCHEMA repmgr; * The table repl_nodes keeps information about all machines in * a cluster */ -drop table if exists repl_nodes cascade; CREATE TABLE repl_nodes ( id integer primary key, cluster text not null, -- Name to identify the cluster @@ -17,7 +23,6 @@ ALTER TABLE repl_nodes OWNER TO repmgr; * Keeps monitor info about every node and their relative "position" * to primary */ -drop table if exists repl_monitor cascade; CREATE TABLE repl_monitor ( primary_node INTEGER NOT NULL, standby_node INTEGER NOT NULL, @@ -40,7 +45,6 @@ ALTER TABLE repl_monitor OWNER TO repmgr; * have received) * time_lag: how many seconds are we from being up-to-date with master */ -drop view if exists repl_status; CREATE VIEW repl_status AS WITH monitor_info AS (SELECT *, ROW_NUMBER() OVER (PARTITION BY primary_node, standby_node ORDER BY last_monitor_time desc) diff --git a/uninstall_repmgr.sql b/uninstall_repmgr.sql new file mode 100644 index 00000000..8cb1b4de --- /dev/null +++ b/uninstall_repmgr.sql @@ -0,0 +1,13 @@ +/* + * uninstall_repmgr.sql + * + * Copyright (c) Heroku, 2010 + * + */ + +DROP TABLE IF EXISTS repl_nodes; +DROP TABLE IF EXISTS repl_monitor; +DROP VIEW IF EXISTS repl_status; + +DROP SCHEMA repmgr; +DROP USER repmgr;