Updated DB scripts

This commit is contained in:
George Kalampokis 2020-10-26 13:11:54 +02:00
parent 29c6774558
commit 96ffbe6670
5 changed files with 20 additions and 5 deletions

View File

@ -59,6 +59,7 @@ CREATE TABLE public."Credential" (
"Status" numeric NOT NULL,
"Provider" numeric NOT NULL,
"Public" character varying NOT NULL,
"Email" character varying,
"Secret" character varying NOT NULL,
"CreationTime" timestamp(4) with time zone NOT NULL,
"LastUpdateTime" timestamp(4) with time zone NOT NULL,
@ -571,13 +572,14 @@ ALTER TABLE public."Lock" OWNER TO :POSTGRES_USER;
-- Name: LoginConfirmationEmail; Type: TABLE; Schema: public; Owner: :POSTGRES_USER
--
CREATE TABLE public."LoginConfirmationEmail" (
CREATE TABLE public."EmailConfirmation" (
"ID" uuid NOT NULL,
email character varying NOT NULL,
"isConfirmed" boolean NOT NULL,
token uuid NOT NULL,
"userId" uuid NOT NULL,
"expiresAt" timestamp(4) with time zone NOT NULL
"expiresAt" timestamp(4) with time zone NOT NULL,
data text
);

View File

@ -0,0 +1,16 @@
DO $$DECLARE
this_version CONSTANT varchar := '00.00.006';
BEGIN
PERFORM * FROM "DBVersion" WHERE version = this_version;
IF FOUND THEN RETURN; END IF;
ALTER TABLE public."Credential" ADD COLUMN email character varying;
ALTER TABLE public."LoginConfirmationEmail" RENAME TO "EmailConfirmation";
ALTER TABLE public."EmailConfirmation" ADD COLUMN data text;
UPDATE public."Credential" cred SET "Email"= u.email FROM public."UserInfo" u WHERE cred."UserId" = u.id;
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.00.006', '2020-10-26 10:10:00.000000+03', now(), 'Update Credential and LoginConfirmationEmail tables');
END$$;

View File

@ -1 +0,0 @@
ALTER TABLE public."Credential" ADD COLUMN email character varying;

View File

@ -1 +0,0 @@
ALTER TABLE public."LoginConfirmationEmail" RENAME TO "EmailConfirmation";

View File

@ -1 +0,0 @@
ALTER TABLE public."EmailConfirmation" ADD COLUMN data text;