/* Unique Ids sequence generator */
-drop sequence SEQ_GEN_SEQUENCE;
+drop sequence if exists SEQ_GEN_SEQUENCE;
create sequence SEQ_GEN_SEQUENCE START WITH 1000 INCREMENT BY 50;
);
create index usergroup_groupId_idx ON USERGROUP(groupId);
+
+
DROP TABLE IF EXISTS GROUPPERMISSIONS CASCADE;
CREATE TABLE GROUPPERMISSIONS (
id bigint NOT NULL PRIMARY KEY,
name varchar(255),
type varchar(255),
value varchar(255),
- attribute_group_id bigint REFERENCES attribute_group (id),
+ attribute_group_id bigint not null REFERENCES attribute_group (id),
mandatory boolean
);
-DROP TABLE IF EXISTS attribute_group_attribute CASCADE;
-CREATE TABLE attribute_group_attribute (
- attributegroup_id bigint REFERENCES attribute_group (id) on delete cascade,
- attribute_id bigint REFERENCES attribute(id) on delete cascade
+/* PROFILE */
+
+DROP TABLE IF EXISTS profile CASCADE;
+CREATE TABLE profile (
+ id bigint NOT NULL PRIMARY KEY,
+ name varchar(255)
+);
+
+DROP TABLE IF EXISTS profile_attribute CASCADE;
+CREATE TABLE profile_attribute (
+ id bigint NOT NULL PRIMARY KEY,
+ name varchar(255),
+ type varchar(255),
+ mandatory boolean,
+ profile_id bigint not null REFERENCES profile (id)
);
-CREATE INDEX attribute_group_attribute_idx1 on attribute_group_attribute(attributegroup_id);
-CREATE INDEX attribute_group_attribute_idx2 on attribute_group_attribute(attribute_id);
/* DATA */
);
/* PROFILES */
-DROP TABLE IF EXISTS profile CASCADE;
-CREATE TABLE profile (
- id bigint NOT NULL PRIMARY KEY,
- name varchar(255)
-);
-
-DROP TABLE IF EXISTS profile_attribute CASCADE;
-CREATE TABLE profile_attribute (
- id bigint NOT NULL PRIMARY KEY,
- name varchar(255),
- type varchar(255),
- mandatory boolean,
- profile_id bigint REFERENCES profile (id)
-);
-- The 1000 first ids are reserved for initial data
INSERT INTO users (id,username,userpassword) VALUES (1,'admin','edf123');