Update DataManagementPlanDB.sql

This commit is contained in:
Nikolaos Laskaris 2017-10-18 12:17:00 +02:00
parent ff2eac1bc9
commit 4f6d949dab
1 changed files with 18 additions and 6 deletions

View File

@ -447,12 +447,13 @@ ALTER TABLE ONLY "DatasetService"
ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID"); ADD CONSTRAINT "DatasetServiceServiceReference" FOREIGN KEY ("Service") REFERENCES "Service"("ID");
DROP table if exists "UserDMP";
DROP table if exists "UserInfo"; DROP table if exists "UserInfo";
DROP table if exists "UserAuth";
CREATE TABLE "UserInfo" ( CREATE TABLE "UserInfo" (
"autoid" uuid DEFAULT uuid_generate_v4() NOT NULL, "id" uuid DEFAULT uuid_generate_v4() UNIQUE NOT NULL,
"identification" character varying(500) NOT NULL, "email" character varying(250) UNIQUE NOT NULL,
"email" character varying(250) NOT NULL,
"authorization_level" smallint NOT NULL, "authorization_level" smallint NOT NULL,
"usertype" smallint NOT NULL, "usertype" smallint NOT NULL,
"authentication" uuid, "authentication" uuid,
@ -461,15 +462,13 @@ CREATE TABLE "UserInfo" (
"created" timestamp, "created" timestamp,
"lastloggedin" timestamp, "lastloggedin" timestamp,
"additionalinfo" xml, "additionalinfo" xml,
PRIMARY KEY (identification, email) PRIMARY KEY (id)
); );
COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore'; COMMENT ON COLUMN "UserInfo"."authorization_level" IS 'This stores the authorization level of the user: 0 admin, 1 user, being able to be extended furthermore';
COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external'; COMMENT ON COLUMN "UserInfo"."usertype" IS 'This stores the type of user: 0 -> internal, 1 external';
DROP table if exists "UserAuth";
CREATE TABLE "UserAuth" ( CREATE TABLE "UserAuth" (
"id" uuid DEFAULT uuid_generate_v4() NOT NULL UNIQUE, "id" uuid DEFAULT uuid_generate_v4() NOT NULL UNIQUE,
"username" character varying(200) NOT NULL, "username" character varying(200) NOT NULL,
@ -483,8 +482,21 @@ ALTER TABLE "UserInfo" ADD CONSTRAINT fkey_userinfo_userauth FOREIGN KEY ("authe
COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash'; COMMENT ON COLUMN "UserAuth"."password" IS 'This field stores a password hash';
create table "UserDMP" (
"id" uuid DEFAULT uuid_generate_v4() NOT NULL,
"user" uuid NOT NULL,
"dmp" uuid NOT NUll,
"role" integer
);
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_user FOREIGN KEY ("user") REFERENCES "UserInfo"("id");
ALTER TABLE "UserDMP" ADD CONSTRAINT fkey_userdmp_dmp FOREIGN KEY ("dmp") REFERENCES "DMP"("ID");
ALTER TABLE "UserInfo" OWNER TO dmptool; ALTER TABLE "UserInfo" OWNER TO dmptool;
ALTER TABLE "UserAuth" OWNER TO dmptool; ALTER TABLE "UserAuth" OWNER TO dmptool;
ALTER TABLE "UserDMP" OWNER TO dmptool;