[icinga-checkins] icinga.org: icinga-web/mfriedrich/fixes: * PostgreSQL update script for 1. 2 -> 1.3

git at icinga.org git at icinga.org
Thu Jan 13 17:54:24 CET 2011


Module: icinga-web
Branch: mfriedrich/fixes
Commit: 916c3917b7cd137461ba1c5477209092fe6d33db
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=916c3917b7cd137461ba1c5477209092fe6d33db

Author: Gunnar Beutner <gunnar.beutner at netways.de>
Date:   Wed Jan 12 10:33:49 2011 +0100

* PostgreSQL update script for 1.2 -> 1.3

---

 etc/schema/updates/pgsql_v1-2_to_v1-3.sql |   81 +++++++++++++++++++++++++++++
 1 files changed, 81 insertions(+), 0 deletions(-)

diff --git a/etc/schema/updates/pgsql_v1-2_to_v1-3.sql b/etc/schema/updates/pgsql_v1-2_to_v1-3.sql
new file mode 100644
index 0000000..a78f322
--- /dev/null
+++ b/etc/schema/updates/pgsql_v1-2_to_v1-3.sql
@@ -0,0 +1,81 @@
+CREATE SEQUENCE cronk_category_cc_id_seq
+	START WITH 1
+	INCREMENT BY 1
+	NO MAXVALUE
+	NO MINVALUE
+	CACHE 1;
+
+CREATE SEQUENCE cronk_cronk_id_seq
+	START WITH 1
+	INCREMENT BY 1
+	NO MAXVALUE
+	NO MINVALUE
+	CACHE 1;
+
+CREATE TABLE cronk (
+	cronk_id integer DEFAULT nextval('cronk_cronk_id_seq'::regclass) NOT NULL,
+	cronk_uid character varying(45),
+	cronk_name character varying(45),
+	cronk_description character varying(100),
+	cronk_xml text,
+	cronk_user_id integer,
+	cronk_created timestamp without time zone NOT NULL,
+	cronk_modified timestamp without time zone NOT NULL
+);
+
+CREATE TABLE cronk_category (
+	cc_id integer DEFAULT nextval('cronk_category_cc_id_seq'::regclass) NOT NULL,
+	cc_uid character varying(45) NOT NULL,
+	cc_name character varying(45),
+	cc_visible smallint DEFAULT 0,
+	cc_position integer DEFAULT 0,
+	cc_created timestamp without time zone NOT NULL,
+	cc_modified timestamp without time zone NOT NULL
+);
+
+CREATE TABLE cronk_category_cronk (
+	ccc_cc_id integer NOT NULL,
+	ccc_cronk_id integer NOT NULL
+);
+
+CREATE TABLE cronk_principal_cronk (
+	cpc_principal_id integer NOT NULL,
+	cpc_cronk_id integer NOT NULL
+);
+
+ALTER TABLE cronk
+	ADD CONSTRAINT cronk_pkey PRIMARY KEY (cronk_id);
+
+ALTER TABLE cronk_category
+	ADD CONSTRAINT cronk_category_pkey PRIMARY KEY (cc_id);
+
+ALTER TABLE cronk_category_cronk
+	ADD CONSTRAINT cronk_category_cronk_pkey PRIMARY KEY (ccc_cc_id, ccc_cronk_id);
+
+ALTER TABLE cronk_principal_cronk
+	ADD CONSTRAINT cronk_principal_cronk_pkey PRIMARY KEY (cpc_principal_id, cpc_cronk_id);
+
+ALTER TABLE cronk
+	ADD CONSTRAINT cronk_cronk_user_id_nsm_user_user_id FOREIGN KEY (cronk_user_id) REFERENCES nsm_user(user_id);
+
+ALTER TABLE cronk_category_cronk
+	ADD CONSTRAINT cronk_category_cronk_ccc_cc_id_cronk_category_cc_id FOREIGN KEY (ccc_cc_id) REFERENCES cronk_category(cc_id);
+
+ALTER TABLE cronk_category_cronk
+	ADD CONSTRAINT cronk_category_cronk_ccc_cronk_id_cronk_cronk_id FOREIGN KEY (ccc_cronk_id) REFERENCES cronk(cronk_id);
+
+ALTER TABLE cronk_principal_cronk
+	ADD CONSTRAINT ccnp FOREIGN KEY (cpc_principal_id) REFERENCES nsm_principal(principal_id);
+
+ALTER TABLE cronk_principal_cronk
+	ADD CONSTRAINT cronk_principal_cronk_cpc_cronk_id_cronk_cronk_id FOREIGN KEY (cpc_cronk_id) REFERENCES cronk(cronk_id);
+
+CREATE UNIQUE INDEX cronk_uid_unique ON cronk USING btree (cronk_uid);
+
+CREATE UNIQUE INDEX cc_uid_unique ON cronk_category USING btree (cc_uid);
+
+-- Adding new credential and add them to appkit_admin
+
+INSERT INTO nsm_target (target_id, target_name, target_description, target_type) VALUES ('15', 'icinga.cronk.category.admin', 'Enables category admin feature', 'credential');
+
+INSERT INTO nsm_principal_target (pt_id, pt_principal_id, pt_target_id) VALUES ('8', '3', '15');





More information about the icinga-checkins mailing list