From f7614b43520a0cfff51e18609795f56f5c4137ec Mon Sep 17 00:00:00 2001 From: jojo aquino Date: Fri, 25 Apr 2025 22:16:58 +0100 Subject: [PATCH] add 03_UserTracker --- .../EnotaryoPH.DbMigration.csproj | 1 + .../Scripts/03_UserTracker.sql | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 EnotaryoPH/EnotaryoPH.DbMigration/Scripts/03_UserTracker.sql diff --git a/EnotaryoPH/EnotaryoPH.DbMigration/EnotaryoPH.DbMigration.csproj b/EnotaryoPH/EnotaryoPH.DbMigration/EnotaryoPH.DbMigration.csproj index e954aa9..096bcdd 100644 --- a/EnotaryoPH/EnotaryoPH.DbMigration/EnotaryoPH.DbMigration.csproj +++ b/EnotaryoPH/EnotaryoPH.DbMigration/EnotaryoPH.DbMigration.csproj @@ -13,6 +13,7 @@ + diff --git a/EnotaryoPH/EnotaryoPH.DbMigration/Scripts/03_UserTracker.sql b/EnotaryoPH/EnotaryoPH.DbMigration/Scripts/03_UserTracker.sql new file mode 100644 index 0000000..69f4387 --- /dev/null +++ b/EnotaryoPH/EnotaryoPH.DbMigration/Scripts/03_UserTracker.sql @@ -0,0 +1,45 @@ +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;