Commit 29d95f10 by ansible

Add Create DMA Table Script

1 parent b5b9a28d
......@@ -150,8 +150,6 @@ MINVALUE 1
MAXVALUE 9223372036854775807
START 1;
CREATE TABLE public.wd_admin_user (
username varchar(50) NULL,
password varchar(50) NULL,
......@@ -194,8 +192,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_user_authen_temp (
id int4 NOT NULL DEFAULT nextval('wd_user_authen_temp_id_seq'::regclass),
"name" varchar(500) NULL,
......@@ -230,7 +226,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_authen_input_temp (
id int4 NOT NULL DEFAULT nextval('wd_authen_input_temp_id_seq'::regclass),
"index" int4 NULL,
......@@ -246,10 +241,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_authen_output_publish (
id integer NOT NULL,
field_name character varying(100),
......@@ -268,9 +259,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_authen_output_temp (
id integer NOT NULL DEFAULT nextval('wd_authen_output_temp_id_seq'::regclass),
field_name character varying(100),
......@@ -289,7 +277,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_user (
"userId" varchar(40) NOT NULL,
password varchar(30) NULL,
......@@ -340,10 +327,6 @@ WITH (
) ;
CREATE UNIQUE INDEX wd_block_user_id_uindex ON public.wd_block_user (id DESC) ;
CREATE TABLE public.wd_group (
id int4 NOT NULL DEFAULT nextval('wd_group_id_seq'::regclass),
"key" varchar(50) NULL,
......@@ -365,9 +348,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_group_user_rel (
"groupId" int4 NOT NULL,
"userId" int4 NOT NULL,
......@@ -389,8 +369,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_menu (
id int4 NOT NULL DEFAULT nextval('wd_menu_id_seq'::regclass),
"menuId" varchar(200) NOT NULL,
......@@ -408,9 +386,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_sys_config (
id int4 NOT NULL DEFAULT nextval('wd_sys_config_id_seq'::regclass),
sys_group varchar(100) NOT NULL,
......@@ -424,11 +399,6 @@ WITH (
) ;
CREATE UNIQUE INDEX wd_sys_config_unique_index ON public.wd_sys_config (sys_group,sys_key) ;
CREATE TABLE public.wd_user_role (
id int4 NOT NULL DEFAULT nextval('wd_user_role_id_seq'::regclass),
"name" varchar(50) NULL,
......@@ -454,12 +424,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_user_additional (
id int4 NOT NULL DEFAULT nextval('wd_user_additional_id_seq'::regclass),
"userId" varchar(40) NOT NULL,
......@@ -482,9 +446,6 @@ WITH (
OIDS=FALSE
) ;
CREATE TABLE public.wd_user_app_rel (
id int4 NOT NULL DEFAULT nextval('wd_user_app_rel_id_seq'::regclass),
"userId" int4 NOT NULL,
......@@ -506,10 +467,6 @@ WITH (
CREATE INDEX wd_user_app_rel_idx_devicekey ON public.wd_user_app_rel ("deviceKey" DESC) ;
CREATE INDEX wd_user_app_rel_idx_userid ON public.wd_user_app_rel ("userId" DESC) ;
CREATE TABLE public.wd_chat_message (
id int4 NOT NULL DEFAULT nextval('wd_chat_message_id_seq'::regclass),
"key" varchar(100) NULL,
......@@ -575,8 +532,6 @@ WITH (
) ;
CREATE UNIQUE INDEX wd_message_user_rel_constain_unique ON public.wd_message_user_rel ("messageId" DESC,"userId" DESC) ;
CREATE TABLE public.wd_personal_contract (
id int4 NOT NULL DEFAULT nextval('wd_personal_contract_seq'::regclass),
"actionUserId" int4 NOT NULL,
......
-- initial wd_admin_user
INSERT INTO public.wd_admin_user (username,password,actived,id) VALUES (
'admin','vP9+lL7ByjRBGATW6zVJvw==',true,1);
......@@ -7,7 +6,6 @@ INSERT INTO public.wd_admin_user (username,password,actived,id) VALUES (
INSERT INTO public.wd_authen_type (id,"name",value,active) VALUES (
1,'Web Service','WS',true);
-- initial wd_menu
INSERT INTO public.wd_menu (id,"menuId","name",link,image,image_cover,seq,actived) VALUES (
1,'idAnalytics','Analytics','../Analytics','../../resources/images/common/ic_analytics.png',NULL,1,true);
......@@ -26,7 +24,6 @@ INSERT INTO public.wd_menu
(id, "menuId", "name", link, image, image_cover, seq, actived)
VALUES(7, 'idChangePassword', 'Change Pass', '../ChangePassword', '../../resources/images/common/ic_changePassword.png', NULL, 7, true);
-- initial wd_sys_config
INSERT INTO public.wd_sys_config (id,sys_group,sys_key,sys_value,sys_description) VALUES (
1,'console','userId','admin',NULL);
......@@ -168,9 +165,6 @@ INSERT INTO public.wd_sys_config
(id, sys_group, sys_key, sys_value, sys_description)
VALUES(65, 'system', 'mqtt_password', 'BBgXC8zQ7WGmcpVa', 'Mqtt authen');
INSERT INTO public.wd_sys_config
(id, sys_group, sys_key, sys_value, sys_description)
VALUES(67, 'Housekeeping', 'MaxMsgPerPage', '500', 'Maximum archrive chat log per file');
......@@ -183,7 +177,6 @@ INSERT INTO public.wd_sys_config
(id, sys_group, sys_key, sys_value, sys_description)
VALUES(74, 'limit', 'max_import_user_per_time', '1000', 'Maximum import user per time');
-- initial version
INSERT INTO public.wd_sys_config
(id, sys_group, sys_key, sys_value, sys_description)
......@@ -208,7 +201,6 @@ INSERT INTO public.wd_sys_config
(id, sys_group, sys_key, sys_value, sys_description)
VALUES(76, 'system', 'group_using_lastSync_by_join', 'on', 'sync message add condition lasySync by join group');
-- initial wd_user
INSERT INTO public.wd_user
("userId", password, "displayName", email, "contactNumber", "roleName", "createdDate", "updatedDate", id, "imageLinkUrl", "userKey", "emailVerified", "enableEncryption", timezone, "prefContactAPI", deactivate, "pricingPackage", "lastSeenAtTime", status, "statusMessage", "imageLink", "lastLoggedInAtTime", "lastMessageAtTime", connected)
......@@ -218,7 +210,6 @@ INSERT INTO public.wd_user_app_rel
(id, "userId", "applicationId", "deviceKey", "createdDate", "updatedDate", "registrationId", "userKey", "pushNotificationFormat", "deviceType", "lastSyncTime")
VALUES(1, 1, NULL, 'YWRtaW4jOiM4IzojMTQ5ODEwNjQ3MDE3NSM6Izk2ZGE3Yzc1LTRlNjgtNDZmNS04ZmI2LTQ1MzZlNDk5NzUxZA==', '2017-06-22 11:41:10.177', '2017-06-22 11:41:10.177', NULL, '816edb8c-1011-4160-bfa7-133794d96ea7', NULL, 8, 1498106470175);
-- initial user for transaction log (WD Bot)
INSERT INTO public.wd_user
("userId", password, "displayName", email, "contactNumber", "roleName", "createdDate", "updatedDate", id, "imageLinkUrl", "userKey", "emailVerified", "enableEncryption", timezone, "prefContactAPI", deactivate, "pricingPackage", "lastSeenAtTime", status, "statusMessage", "imageLink", "lastLoggedInAtTime", "lastMessageAtTime", connected)
......@@ -228,7 +219,6 @@ INSERT INTO public.wd_user_app_rel
(id, "userId", "applicationId", "deviceKey", "createdDate", "updatedDate", "registrationId", "userKey", "pushNotificationFormat", "deviceType", "lastSyncTime")
VALUES(2, 2, NULL, 'd2Rib3QjOiMwIzojMTUwNTkwOTQ2MzYzMyM6IzQwMTFhZTVkLTk2ZTItNGZhMC1hOTc4LTYxNWE4ZmVhMTBkMw==', '2017-06-22 11:41:10.177', '2017-06-22 11:41:10.177', NULL, '2af95700-2615-45e0-839a-468b6f7fbd7a', NULL, 8, 1498106470175);
-- initial user for transaction log (DMA Bot)
INSERT INTO public.wd_user
("userId", password, "displayName", email, "contactNumber", "roleName", "createdDate", "updatedDate", id, "imageLinkUrl", "userKey", "emailVerified", "enableEncryption", timezone, "prefContactAPI", deactivate, "pricingPackage", "lastSeenAtTime", status, "statusMessage", "imageLink", "lastLoggedInAtTime", "lastMessageAtTime", connected)
......@@ -238,9 +228,6 @@ INSERT INTO public.wd_user_app_rel
(id, "userId", "applicationId", "deviceKey", "createdDate", "updatedDate", "registrationId", "userKey", "pushNotificationFormat", "deviceType", "lastSyncTime")
VALUES(3, 3, NULL, 'ZG1hYm90IzojMCM6IzE1MDU5MDk0ODI2MjYjOiNmNDQ5ODc0YS1lYzMyLTQ3OTgtOGM5ZS1kODQzNmJhZmY0MmE=', '2017-06-22 11:41:10.177', '2017-06-22 11:41:10.177', NULL, 'f2c2cf53-ab6e-4f4f-a021-a2eacf28c6f4', NULL, 8, 1498106470175);
-- initial wd_version
INSERT INTO public.wd_version (id,version_id) VALUES (
1,'1.0.0');
......
--------------- CREATE TABLE DMA MESSAGE
-- Table: public.dma_message
CREATE SEQUENCE public.dma_message_id_seq
INCREMENT 1
START 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
ALTER SEQUENCE public.dma_message_id_seq
OWNER TO wdchat;
CREATE SEQUENCE public.dma_message_user_rel_id_seq
INCREMENT 1
START 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
ALTER SEQUENCE public.dma_message_user_rel_id_seq
OWNER TO wdchat;
-- DROP TABLE public.dma_message;
CREATE TABLE public.dma_message
(
id integer NOT NULL DEFAULT nextval('dma_message_id_seq'::regclass),
key character varying(100) COLLATE pg_catalog."default",
"fromUserId" integer,
"toUserId" integer,
"contactIds" character varying(2000) COLLATE pg_catalog."default",
message character varying(4096) COLLATE pg_catalog."default",
sent boolean DEFAULT false,
delivered boolean DEFAULT false,
read boolean DEFAULT false,
"createdAtTime" bigint,
type integer,
source integer,
status integer NOT NULL DEFAULT 0,
paired_message_id integer,
"contentType" integer,
group_id integer,
group_name character varying(200) COLLATE pg_catalog."default",
from_user_name character varying(80) COLLATE pg_catalog."default",
metadata character varying(100) COLLATE pg_catalog."default",
delivered_time timestamp without time zone,
"createdDate" timestamp without time zone DEFAULT now(),
"updatedDate" timestamp without time zone DEFAULT now(),
"deviceKey" character varying(200) COLLATE pg_catalog."default",
shared boolean DEFAULT false,
"storeOnDevice" boolean DEFAULT false,
"sentToServer" boolean DEFAULT false,
"sendToDevice" boolean DEFAULT false,
"sentMessageTimeAtServer" integer,
"documentId" character varying COLLATE pg_catalog."default",
delete boolean DEFAULT false,
"paredUserId" character varying(100) COLLATE pg_catalog."default",
CONSTRAINT dma_message_pkey PRIMARY KEY (id),
CONSTRAINT dma_message_fromuserid_wd_user_fk FOREIGN KEY ("fromUserId")
REFERENCES public.wd_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT dma_message_togroupid_wd_group_fk FOREIGN KEY (group_id)
REFERENCES public.wd_group (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT dma_message_touserid_wd_user_fk FOREIGN KEY ("toUserId")
REFERENCES public.wd_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.dma_message
OWNER to wdchat;
-- Index: dma_message_idx_createdattime
-- DROP INDEX public.dma_message_idx_createdattime;
CREATE INDEX dma_message_idx_createdattime
ON public.dma_message USING btree
("createdAtTime")
TABLESPACE pg_default;
-- Table: public.dma_message_user_rel
-- DROP TABLE public.dma_message_user_rel;
CREATE TABLE public.dma_message_user_rel
(
id integer NOT NULL DEFAULT nextval('dma_message_user_rel_id_seq'::regclass),
"messageId" integer NOT NULL,
"userId" integer NOT NULL,
read boolean DEFAULT false,
delete boolean DEFAULT false,
"createdDate" timestamp without time zone NOT NULL DEFAULT now(),
"updatedDate" timestamp without time zone NOT NULL DEFAULT now(),
delivered boolean DEFAULT false,
"deliveredAtTime" timestamp without time zone,
"readAtTime" timestamp without time zone,
blocked boolean DEFAULT false,
"blockedAtTime" timestamp without time zone,
"deleteAtTime" timestamp without time zone,
CONSTRAINT dma_message_user_rel_pk PRIMARY KEY (id),
CONSTRAINT dma_message_user_rel_dma_message_fk FOREIGN KEY ("messageId")
REFERENCES public.dma_message (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION,
CONSTRAINT dma_message_user_rel_wd_user_fk FOREIGN KEY ("userId")
REFERENCES public.wd_user (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
ALTER TABLE public.dma_message_user_rel
OWNER to wdchat;
-- Index: dma_message_user_rel_constain_unique
-- DROP INDEX public.dma_message_user_rel_constain_unique;
CREATE UNIQUE INDEX dma_message_user_rel_constain_unique
ON public.dma_message_user_rel USING btree
("messageId" DESC, "userId" DESC)
TABLESPACE pg_default;
-------------------------------------------------------
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!