﻿BEGIN TRANSACTION;

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "Device" VARCHAR(255);

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "IPAddress" VARCHAR(45);

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "Latitude" DECIMAL(10, 6);

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "Longitude" DECIMAL(10, 6);

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "OTPEntered" VARCHAR(100);

ALTER TABLE "LawyerVideoConferenceParticipants"
ADD COLUMN IF NOT EXISTS "OTPHash" VARCHAR(255);





CREATE TABLE IF NOT EXISTS "UserLogins" (
	"UserLoginID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL,
	"Failed" bool NULL,
	"IPAddress" varchar NULL,
	"Device" varchar NULL,
	"Longitude" float8 NULL,
	"Latitude" float8 NULL,
	"UsegLogin_UID" uuid DEFAULT uuid_generate_v4() NOT NULL,
	"UserID" int8 NULL,
	"CreatedOn" timestamp DEFAULT now() NULL,
	CONSTRAINT "UserLogins_pk" PRIMARY KEY ("UserLoginID"),
	CONSTRAINT "UserLogins_unique" UNIQUE ("UsegLogin_UID")
);


-- public."UserLogins" foreign keys

ALTER TABLE public."UserLogins" ADD CONSTRAINT "UserLogins_Users_FK" FOREIGN KEY ("UserID") REFERENCES "Users"("UserID");


COMMIT TRANSACTION;
