pgsql schema: Make parent column a foreign key as well

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-29 08:54:45 +02:00
parent b123afe594
commit 9fcebb0014
1 changed files with 10 additions and 1 deletions

View File

@ -3,7 +3,7 @@
CREATE TABLE "icingaweb_group" (
"id" serial,
"name" character varying(64) NOT NULL,
"parent" character varying(64) NULL DEFAULT NULL,
"parent" int NULL DEFAULT NULL,
"ctime" timestamp NULL DEFAULT NULL,
"mtime" timestamp NULL DEFAULT NULL
);
@ -20,6 +20,15 @@ CREATE UNIQUE INDEX idx_icingaweb_group
lower((name)::text)
);
ALTER TABLE ONLY "icingaweb_group"
ADD CONSTRAINT fk_icingaweb_group_parent_id
FOREIGN KEY (
"parent"
)
REFERENCES "icingaweb_group" (
"id"
);
CREATE TABLE "icingaweb_group_membership" (
"group_id" int NOT NULL,
"username" character varying(64) NOT NULL,