Merged PR 14: DbUp Project
DbUp Project Cherry picked from !13 Related work items: #113
This commit is contained in:
		
						commit
						0d1c24681a
					
				| @ -0,0 +1,34 @@ | ||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||
| 
 | ||||
|   <PropertyGroup> | ||||
|     <OutputType>Exe</OutputType> | ||||
|     <TargetFramework>net9.0</TargetFramework> | ||||
|     <ImplicitUsings>enable</ImplicitUsings> | ||||
|     <Nullable>enable</Nullable> | ||||
|     <UserSecretsId>d6cabec2-f14e-40aa-b2ef-90a832d8e1e4</UserSecretsId> | ||||
|   </PropertyGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <None Remove="Scripts\01_Schema.sql" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <EmbeddedResource Include="Scripts\02_SeedLookupData.sql" /> | ||||
|     <EmbeddedResource Include="Scripts\01_Schema.sql" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <PackageReference Include="dbup-core" Version="6.0.4" /> | ||||
|     <PackageReference Include="dbup-postgresql" Version="6.0.3" /> | ||||
|     <PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.4" /> | ||||
|     <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.4" /> | ||||
|     <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="9.0.4" /> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
|   <ItemGroup> | ||||
|     <None Update="appsettings.json"> | ||||
|       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||||
|     </None> | ||||
|   </ItemGroup> | ||||
| 
 | ||||
| </Project> | ||||
							
								
								
									
										59
									
								
								EnotaryoPH/EnotaryoPH.DbMigration/Program.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								EnotaryoPH/EnotaryoPH.DbMigration/Program.cs
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,59 @@ | ||||
| using System.Reflection; | ||||
| using DbUp; | ||||
| using Microsoft.Extensions.Configuration; | ||||
| 
 | ||||
| namespace EnotaryoPH.DbMigration | ||||
| { | ||||
|     internal class Program | ||||
|     { | ||||
|         private static int Main(string[] args) | ||||
|         { | ||||
|             Console.ForegroundColor = ConsoleColor.Yellow; | ||||
| 
 | ||||
|             var config = new ConfigurationBuilder() | ||||
|                 .AddJsonFile("appsettings.json") | ||||
|                 .Build(); | ||||
|             var connectionString = | ||||
|                 args.FirstOrDefault() | ||||
|                 ?? config.GetConnectionString("DbUpConnection"); | ||||
| 
 | ||||
|             Console.WriteLine($"Connecting to {connectionString}"); | ||||
| 
 | ||||
|             var upgrader = | ||||
|                 DeployChanges.To | ||||
|                     .PostgresqlDatabase(connectionString) | ||||
|                     .WithVariablesDisabled() | ||||
|                     .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) | ||||
|                     .LogToConsole() | ||||
|                     .Build(); | ||||
| 
 | ||||
|             if (upgrader.TryConnect(out var err)) | ||||
|             { | ||||
|                 var result = upgrader.PerformUpgrade(); | ||||
| 
 | ||||
|                 if (!result.Successful) | ||||
|                 { | ||||
|                     Console.ForegroundColor = ConsoleColor.Red; | ||||
|                     Console.WriteLine(result.Error); | ||||
|                     Console.ResetColor(); | ||||
| #if DEBUG | ||||
|                     Console.ReadLine(); | ||||
| #endif | ||||
|                     return -1; | ||||
|                 } | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 Console.ForegroundColor = ConsoleColor.Red; | ||||
|                 Console.WriteLine($"Cannot Connect: '{err}'"); | ||||
|                 Console.ResetColor(); | ||||
|                 return -1; | ||||
|             } | ||||
| 
 | ||||
|             Console.ForegroundColor = ConsoleColor.Green; | ||||
|             Console.WriteLine("Success!"); | ||||
|             Console.ResetColor(); | ||||
|             return 0; | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										715
									
								
								EnotaryoPH/EnotaryoPH.DbMigration/Scripts/01_Schema.sql
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										715
									
								
								EnotaryoPH/EnotaryoPH.DbMigration/Scripts/01_Schema.sql
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,715 @@ | ||||
|  | ||||
| 
 | ||||
| CREATE EXTENSION if not EXISTS "uuid-ossp" | ||||
| 	SCHEMA "public" | ||||
| 	VERSION "1.1"; | ||||
| 
 | ||||
| 
 | ||||
| -- DROP SCHEMA public; | ||||
| 
 | ||||
| CREATE SCHEMA IF NOT EXISTS public AUTHORIZATION pg_database_owner; | ||||
| 
 | ||||
| -- DROP SEQUENCE "LawyerVideoConferenceParticip_LawyerVideoConferenceParticip_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "LawyerVideoConferenceParticip_LawyerVideoConferenceParticip_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "LawyerVideoConferenceSchedule_LawyerVideoConferenceSchedule_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "LawyerVideoConferenceSchedule_LawyerVideoConferenceSchedule_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "LookupDataValues_LookupDataValueID_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "LookupDataValues_LookupDataValueID_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "LookupData_LookupDataID_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "LookupData_LookupDataID_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "TransactionDeclineReasons_TransactionDeclineReasonID_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "TransactionDeclineReasons_TransactionDeclineReasonID_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "TransactionSelfies_TransactionSelfieID_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "TransactionSelfies_TransactionSelfieID_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "TransactionSignatoryDeclineRe_TransactionSignatoryDeclineRe_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "TransactionSignatoryDeclineRe_TransactionSignatoryDeclineRe_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE "VideoRecordings_VideoRecordingID_seq"; | ||||
| 
 | ||||
| CREATE SEQUENCE "VideoRecordings_VideoRecordingID_seq" | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE errorlogs_errorlogid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE errorlogs_errorlogid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE eventlogs_eventlogid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE eventlogs_eventlogid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE identificationdocuments_identificationdocumentid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE identificationdocuments_identificationdocumentid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE lawyers_lawyerid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE lawyers_lawyerid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE templates_templateid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE templates_templateid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 2147483647 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE transactiondocuments_transactiondocumentid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE transactiondocuments_transactiondocumentid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE transactionnotary_transactionnotaryid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE transactionnotary_transactionnotaryid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE transactionotp_transactionotpid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE transactionotp_transactionotpid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE transactions_transactionid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE transactions_transactionid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE transactionsignatories_transactionsignatoryid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE transactionsignatories_transactionsignatoryid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE; | ||||
| -- DROP SEQUENCE users_userid_seq; | ||||
| 
 | ||||
| CREATE SEQUENCE users_userid_seq | ||||
| 	INCREMENT BY 1 | ||||
| 	MINVALUE 1 | ||||
| 	MAXVALUE 9223372036854775807 | ||||
| 	START 1 | ||||
| 	CACHE 1 | ||||
| 	NO CYCLE;-- public."ErrorLogs" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "ErrorLogs"; | ||||
| 
 | ||||
| CREATE TABLE "ErrorLogs" ( | ||||
| 	"ErrorLogID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"Message" varchar NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"Severity" varchar NULL, | ||||
| 	"Exception" varchar NULL, | ||||
| 	"Stacktrace" varchar NULL, | ||||
| 	"ErrorLog_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT errorlogs_pk PRIMARY KEY ("ErrorLogID") | ||||
| ); | ||||
| CREATE INDEX "ErrorLogs_CreatedOn_IDX" ON public."ErrorLogs" USING btree ("CreatedOn" DESC); | ||||
| CREATE UNIQUE INDEX "ErrorLogs_ErrorLog_UID_IDX" ON public."ErrorLogs" USING btree ("ErrorLog_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."LookupData" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "LookupData"; | ||||
| 
 | ||||
| CREATE TABLE "LookupData" ( | ||||
| 	"LookupDataID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"LookupData_UID" uuid DEFAULT uuid_generate_v4() NOT NULL, | ||||
| 	"Category" varchar NULL, | ||||
| 	"ParentCategory" varchar NULL, | ||||
| 	"Name" varchar NOT NULL, | ||||
| 	"Description" varchar NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	CONSTRAINT "LookupData_pk" PRIMARY KEY ("LookupDataID"), | ||||
| 	CONSTRAINT "LookupData_unique" UNIQUE ("LookupData_UID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "LookupData_Name_Category_IDX" ON public."LookupData" USING btree ("Name", "Category"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."Templates" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "Templates"; | ||||
| 
 | ||||
| CREATE TABLE "Templates" ( | ||||
| 	"TemplateID" int4 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"Name" varchar NOT NULL, | ||||
| 	"Description" varchar NULL, | ||||
| 	"Pagecount" int4 NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"TemplateUrl" varchar NULL, | ||||
| 	"Template_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT templates_pk PRIMARY KEY ("TemplateID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."Users" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "Users"; | ||||
| 
 | ||||
| CREATE TABLE "Users" ( | ||||
| 	"UserID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"Email" varchar NOT NULL, | ||||
| 	"PasswordHash" varchar NOT NULL, | ||||
| 	"PhoneNumber" varchar NULL, | ||||
| 	"Firstname" varchar NULL, | ||||
| 	"Lastname" varchar NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"User_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"Role" varchar DEFAULT 'user'::character varying NULL, | ||||
| 	"BirthDate" date NOT NULL, | ||||
| 	"Middlename" varchar NULL, | ||||
| 	"Suffix" varchar NULL, | ||||
| 	"Prefix" varchar NULL, | ||||
| 	CONSTRAINT users_pk PRIMARY KEY ("UserID"), | ||||
| 	CONSTRAINT users_unique_email UNIQUE ("Email"), | ||||
| 	CONSTRAINT users_unique_uid UNIQUE ("User_UID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."EventLogs" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "EventLogs"; | ||||
| 
 | ||||
| CREATE TABLE "EventLogs" ( | ||||
| 	"EventLogID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"StreamID" int8 NOT NULL, | ||||
| 	"LogType" varchar NOT NULL, | ||||
| 	"LogDate" time DEFAULT now() NULL, | ||||
| 	"UserID" int8 NULL, | ||||
| 	"Payload" varchar NOT NULL, | ||||
| 	"Description" varchar NULL, | ||||
| 	"EventLog_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT eventlogs_pk PRIMARY KEY ("EventLogID"), | ||||
| 	CONSTRAINT eventlogs_users_fk FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "EventLogs_EventLog_UID_IDX" ON public."EventLogs" USING btree ("EventLog_UID"); | ||||
| CREATE INDEX "EventLogs_LogDate_IDX" ON public."EventLogs" USING btree ("LogDate" DESC); | ||||
| CREATE INDEX "EventLogs_StreamID_IDX" ON public."EventLogs" USING btree ("StreamID"); | ||||
| CREATE INDEX "EventLogs_UserID_IDX" ON public."EventLogs" USING btree ("UserID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."IdentificationDocuments" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "IdentificationDocuments"; | ||||
| 
 | ||||
| CREATE TABLE "IdentificationDocuments" ( | ||||
| 	"IdentificationDocumentID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"Type" varchar NOT NULL, | ||||
| 	"ExpirationDate" date NOT NULL, | ||||
| 	"Filename" varchar NOT NULL, | ||||
| 	"File" bytea NOT NULL, | ||||
| 	"UserID" int8 NOT NULL, | ||||
| 	"IdNumber" varchar NOT NULL, | ||||
| 	"PlaceIssued" varchar NOT NULL, | ||||
| 	"DateIssued" date NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NOT NULL, | ||||
| 	"IdentificationDocument_UID" uuid DEFAULT uuid_generate_v4() NOT NULL, | ||||
| 	"IsDeleted" bool NULL, | ||||
| 	"UploadedOn" timestamp NOT NULL, | ||||
| 	CONSTRAINT identificationdocuments_pk PRIMARY KEY ("IdentificationDocumentID"), | ||||
| 	CONSTRAINT identificationdocuments_users_fk FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "IdentificationDocuments_IdentificationDocument_UID_IDX" ON public."IdentificationDocuments" USING btree ("IdentificationDocument_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."Lawyers" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "Lawyers"; | ||||
| 
 | ||||
| CREATE TABLE "Lawyers" ( | ||||
| 	"LawyerID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"Rollnumber" varchar NULL, | ||||
| 	"IBPNumber" varchar NULL, | ||||
| 	"MCLEComplianceNumber" varchar NULL, | ||||
| 	"MCLEDate" date NULL, | ||||
| 	"PTRNumber" varchar NULL, | ||||
| 	"PTRDate" date NULL, | ||||
| 	"PTRlocation" varchar NULL, | ||||
| 	"OfficeAddress" varchar NULL, | ||||
| 	"UserID" int8 NOT NULL, | ||||
| 	"Lawyer_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"CommissionNumber" varchar NULL, | ||||
| 	"CommissionLocation" varchar NULL, | ||||
| 	"CommissionExpiration" date NULL, | ||||
| 	"Status" varchar DEFAULT 'Registered'::character varying NULL, | ||||
| 	CONSTRAINT lawyers_pk PRIMARY KEY ("LawyerID"), | ||||
| 	CONSTRAINT lawyers_users_fk FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."LookupDataValues" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "LookupDataValues"; | ||||
| 
 | ||||
| CREATE TABLE "LookupDataValues" ( | ||||
| 	"LookupDataValueID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"LookupDataValue_UID" uuid DEFAULT uuid_generate_v4() NOT NULL, | ||||
| 	"LookupDataID" int8 NULL, | ||||
| 	"Value" varchar NOT NULL, | ||||
| 	"Title" varchar NULL, | ||||
| 	"SortOrder" int4 NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	CONSTRAINT "LookupDataValues_pk" PRIMARY KEY ("LookupDataValueID"), | ||||
| 	CONSTRAINT "LookupDataValues_unique" UNIQUE ("LookupDataValue_UID"), | ||||
| 	CONSTRAINT "LookupDataValues_LookupData_FK" FOREIGN KEY ("LookupDataID") REFERENCES "LookupData"("LookupDataID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."Transactions" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "Transactions"; | ||||
| 
 | ||||
| CREATE TABLE "Transactions" ( | ||||
| 	"TransactionID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionDate" date NOT NULL, | ||||
| 	"PrincipalID" int8 NOT NULL, | ||||
| 	"Status" varchar NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"Transaction_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"PreferredLawyerID" int8 NULL, | ||||
| 	"LawyerID" int8 NULL, | ||||
| 	"IsRecorded" bool NULL, | ||||
| 	CONSTRAINT transactions_pk PRIMARY KEY ("TransactionID"), | ||||
| 	CONSTRAINT "Transactions_Lawyers_FK" FOREIGN KEY ("LawyerID") REFERENCES "Lawyers"("LawyerID"), | ||||
| 	CONSTRAINT "Transactions_PreferredLawyers_FK" FOREIGN KEY ("PreferredLawyerID") REFERENCES "Lawyers"("LawyerID"), | ||||
| 	CONSTRAINT "Transactions_Users_FK" FOREIGN KEY ("PrincipalID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE INDEX "Transactions_TransactionDate_IDX" ON public."Transactions" USING btree ("TransactionDate" DESC); | ||||
| CREATE UNIQUE INDEX "Transactions_Transaction_UID_IDX" ON public."Transactions" USING btree ("Transaction_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."LawyerVideoConferenceSchedule" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "LawyerVideoConferenceSchedule"; | ||||
| 
 | ||||
| CREATE TABLE "LawyerVideoConferenceSchedule" ( | ||||
| 	"LawyerVideoConferenceScheduleID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"LawyerID" int8 NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"MeetingDate" timestamp NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"LawyerVideoConferenceSchedule_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"Status" varchar NULL, | ||||
| 	"MeetingRoomID" varchar NULL, | ||||
| 	"MeetingRoomTokenID" varchar NULL, | ||||
| 	"MeetingRoomUserID" varchar NULL, | ||||
| 	"ServerCallID" varchar NULL, | ||||
| 	"RecordingID" varchar NULL, | ||||
| 	CONSTRAINT "LawyerVideoConferenceSchedule_pk" PRIMARY KEY ("LawyerVideoConferenceScheduleID"), | ||||
| 	CONSTRAINT "LawyerVideoConferenceSchedule_unique" UNIQUE ("LawyerVideoConferenceSchedule_UID"), | ||||
| 	CONSTRAINT "LawyerVideoConferenceSchedule_Lawyers_FK" FOREIGN KEY ("LawyerID") REFERENCES "Lawyers"("LawyerID"), | ||||
| 	CONSTRAINT "LawyerVideoConferenceSchedule_Transactions_FK" FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID") | ||||
| ); | ||||
| CREATE INDEX "LawyerVideoConferenceSchedule_RecordingID_IDX" ON public."LawyerVideoConferenceSchedule" USING btree ("RecordingID"); | ||||
| CREATE INDEX "LawyerVideoConferenceSchedule_TransactionID_IDX" ON public."LawyerVideoConferenceSchedule" USING btree ("TransactionID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionDeclineReasons" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionDeclineReasons"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionDeclineReasons" ( | ||||
| 	"TransactionDeclineReasonID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"Reason" varchar NOT NULL, | ||||
| 	"LawyerID" int8 NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"TransactionDeclineReason_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT "TransactionDeclineReasons_pk" PRIMARY KEY ("TransactionDeclineReasonID"), | ||||
| 	CONSTRAINT "TransactionDeclineReasons_Lawyers_FK" FOREIGN KEY ("LawyerID") REFERENCES "Lawyers"("LawyerID"), | ||||
| 	CONSTRAINT "TransactionDeclineReasons_Transactions_FK" FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "TransactionDeclineReasons_TransactionDeclineReason_UID_IDX" ON public."TransactionDeclineReasons" USING btree ("TransactionDeclineReason_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionDocuments" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionDocuments"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionDocuments" ( | ||||
| 	"TransactionDocumentID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"Filename" varchar NOT NULL, | ||||
| 	"Notes" varchar NULL, | ||||
| 	"File" bytea NOT NULL, | ||||
| 	"UploadedOn" timestamp NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"TransactionDocument_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"DocumentType" varchar NOT NULL, | ||||
| 	CONSTRAINT transactiondocuments_pk PRIMARY KEY ("TransactionDocumentID"), | ||||
| 	CONSTRAINT transactiondocuments_transactions_fk FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionNotary" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionNotary"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionNotary" ( | ||||
| 	"TransactionNotaryID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"DocNumber" varchar NULL, | ||||
| 	"BookNumber" varchar NULL, | ||||
| 	"PageNumber" varchar NULL, | ||||
| 	"Series" varchar NULL, | ||||
| 	"SignedOn" date NULL, | ||||
| 	"Remarks" varchar NULL, | ||||
| 	"LawyerID" int8 NOT NULL, | ||||
| 	"CertificateType" varchar NULL, | ||||
| 	"TemplateID" int4 NULL, | ||||
| 	"PageCount" int4 NULL, | ||||
| 	"TransactionNotary_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT transactionnotary_pk PRIMARY KEY ("TransactionNotaryID"), | ||||
| 	CONSTRAINT transactionnotary_lawyers_fk FOREIGN KEY ("LawyerID") REFERENCES "Lawyers"("LawyerID"), | ||||
| 	CONSTRAINT transactionnotary_templates_fk FOREIGN KEY ("TemplateID") REFERENCES "Templates"("TemplateID"), | ||||
| 	CONSTRAINT transactionnotary_transactions_fk FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionOTP" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionOTP"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionOTP" ( | ||||
| 	"TransactionOTPID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"VerifiedOn" time NOT NULL, | ||||
| 	"PrintCoords" varchar NOT NULL, | ||||
| 	"Status" varchar NOT NULL, | ||||
| 	"UserID" int8 NOT NULL, | ||||
| 	"TransactionOTP_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"OTPHash" varchar NOT NULL, | ||||
| 	"OTPUserInput" varchar NULL, | ||||
| 	"IPAddress" varchar NULL, | ||||
| 	"Longitude" numeric NULL, | ||||
| 	"Lattitude" numeric NULL, | ||||
| 	"Device" varchar NULL, | ||||
| 	"File_Liveness" bytea NULL, | ||||
| 	CONSTRAINT transactionotp_pk PRIMARY KEY ("TransactionOTPID"), | ||||
| 	CONSTRAINT "TransactionOTP_Users_FK" FOREIGN KEY ("UserID") REFERENCES "Users"("UserID"), | ||||
| 	CONSTRAINT transactionotp_transactions_fk FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID") | ||||
| ); | ||||
| CREATE INDEX "TransactionOTP_TransactionID_IDX" ON public."TransactionOTP" USING btree ("TransactionID"); | ||||
| CREATE UNIQUE INDEX "TransactionOTP_TransactionOTP_UID_IDX" ON public."TransactionOTP" USING btree ("TransactionOTP_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionSelfies" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionSelfies"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionSelfies" ( | ||||
| 	"TransactionSelfieID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NULL, | ||||
| 	"IdentificationDocumentID" int8 NULL, | ||||
| 	"File" bytea NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"TransactionSelfie_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"UserID" int8 NOT NULL, | ||||
| 	CONSTRAINT "TransactionSelfies_pk" PRIMARY KEY ("TransactionSelfieID"), | ||||
| 	CONSTRAINT "TransactionSelfies_IdentificationDocuments_FK" FOREIGN KEY ("IdentificationDocumentID") REFERENCES "IdentificationDocuments"("IdentificationDocumentID"), | ||||
| 	CONSTRAINT "TransactionSelfies_Transactions_FK" FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID"), | ||||
| 	CONSTRAINT "TransactionSelfies_Users_FK" FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "TransactionSelfies_TransactionSelfie_UID_IDX" ON public."TransactionSelfies" USING btree ("TransactionSelfie_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionSignatories" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionSignatories"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionSignatories" ( | ||||
| 	"TransactionSignatoryID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"UserID" int8 NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"Status" varchar NOT NULL, | ||||
| 	"Email" varchar NOT NULL, | ||||
| 	"Type" varchar NOT NULL, | ||||
| 	"TransactionSignatory_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"InvitationCode" varchar NOT NULL, | ||||
| 	CONSTRAINT transactionsignatories_pk PRIMARY KEY ("TransactionSignatoryID"), | ||||
| 	CONSTRAINT transactionsignatories_transactions_fk FOREIGN KEY ("TransactionID") REFERENCES "Transactions"("TransactionID"), | ||||
| 	CONSTRAINT transactionsignatories_users_fk FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE INDEX "TransactionSignatories_InvitationCode_IDX" ON public."TransactionSignatories" USING btree ("InvitationCode"); | ||||
| CREATE INDEX "TransactionSignatories_TransactionID_IDX" ON public."TransactionSignatories" USING btree ("TransactionID", "Email"); | ||||
| CREATE UNIQUE INDEX "TransactionSignatories_TransactionSignatory_UID_IDX" ON public."TransactionSignatories" USING btree ("TransactionSignatory_UID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."TransactionSignatoryDeclineReasons" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "TransactionSignatoryDeclineReasons"; | ||||
| 
 | ||||
| CREATE TABLE "TransactionSignatoryDeclineReasons" ( | ||||
| 	"TransactionSignatoryDeclineReasonID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"UserID" int8 NOT NULL, | ||||
| 	"DeclineReason" varchar NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"TransactionSignatoryDeclineReason_UID" uuid DEFAULT uuid_generate_v4() NOT NULL, | ||||
| 	"TransactionID" int8 NOT NULL, | ||||
| 	"TransactionSignatoryID" int8 NULL, | ||||
| 	CONSTRAINT "TransactionSignatoryDeclineReasons_pk" PRIMARY KEY ("TransactionSignatoryDeclineReasonID"), | ||||
| 	CONSTRAINT "TransactionSignatoryDeclineReasons_unique" UNIQUE ("TransactionSignatoryDeclineReason_UID"), | ||||
| 	CONSTRAINT "TransactionSignatoryDeclineReasons_TransactionSignatories_FK" FOREIGN KEY ("TransactionSignatoryID") REFERENCES "TransactionSignatories"("TransactionSignatoryID"), | ||||
| 	CONSTRAINT "TransactionSignatoryDeclineReasons_Users_FK" FOREIGN KEY ("UserID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE INDEX "TransactionSignatoryDeclineReasons_UserID_IDX" ON public."TransactionSignatoryDeclineReasons" USING btree ("UserID", "TransactionID"); | ||||
| 
 | ||||
| 
 | ||||
| -- public."VideoRecordings" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "VideoRecordings"; | ||||
| 
 | ||||
| CREATE TABLE "VideoRecordings" ( | ||||
| 	"VideoRecordingID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"VideoConferenceScheduleID" int8 NOT NULL, | ||||
| 	"Path" varchar NOT NULL, | ||||
| 	"LocationType" varchar NOT NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"VideoRecording_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	CONSTRAINT "VideoRecordings_pk" PRIMARY KEY ("VideoRecordingID"), | ||||
| 	CONSTRAINT "VideoRecordings_unique" UNIQUE ("VideoConferenceScheduleID"), | ||||
| 	CONSTRAINT "VideoRecordings_unique_UID" UNIQUE ("VideoRecording_UID"), | ||||
| 	CONSTRAINT "VideoRecordings_LawyerVideoConferenceSchedule_FK" FOREIGN KEY ("VideoConferenceScheduleID") REFERENCES "LawyerVideoConferenceSchedule"("LawyerVideoConferenceScheduleID") | ||||
| ); | ||||
| 
 | ||||
| 
 | ||||
| -- public."LawyerVideoConferenceParticipants" definition | ||||
| 
 | ||||
| -- Drop table | ||||
| 
 | ||||
| -- DROP TABLE "LawyerVideoConferenceParticipants"; | ||||
| 
 | ||||
| CREATE TABLE "LawyerVideoConferenceParticipants" ( | ||||
| 	"LawyerVideoConferenceParticipantID" int8 GENERATED ALWAYS AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, | ||||
| 	"LawyerVideoConferenceScheduleID" int8 NOT NULL, | ||||
| 	"ParticipantID" int8 NOT NULL, | ||||
| 	"Status" varchar NULL, | ||||
| 	"CreatedOn" timestamp DEFAULT now() NULL, | ||||
| 	"LawyerVideoConferenceParticipant_UID" uuid DEFAULT uuid_generate_v4() NULL, | ||||
| 	"MeetingRoomTokenID" varchar NULL, | ||||
| 	"MeetingRoomUserID" varchar NULL, | ||||
| 	CONSTRAINT "LawyerVideoConferenceParticipants_pk" PRIMARY KEY ("LawyerVideoConferenceParticipantID"), | ||||
| 	CONSTRAINT "LawyerVideoConferenceParticipants_LawyerVideoConferenceSchedule" FOREIGN KEY ("LawyerVideoConferenceScheduleID") REFERENCES "LawyerVideoConferenceSchedule"("LawyerVideoConferenceScheduleID"), | ||||
| 	CONSTRAINT "LawyerVideoConferenceParticipants_Users_FK" FOREIGN KEY ("ParticipantID") REFERENCES "Users"("UserID") | ||||
| ); | ||||
| CREATE UNIQUE INDEX "LawyerVideoConferenceParticipants_LawyerVideoConferenceParticip" ON public."LawyerVideoConferenceParticipants" USING btree ("LawyerVideoConferenceParticipant_UID"); | ||||
| CREATE UNIQUE INDEX "LawyerVideoConferenceParticipants_LawyerVideoConferenceSchedule" ON public."LawyerVideoConferenceParticipants" USING btree ("LawyerVideoConferenceScheduleID", "ParticipantID"); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_generate_v1(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_generate_v1() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_generate_v1$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_generate_v1mc(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_generate_v1mc() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_generate_v1mc$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_generate_v3(uuid, text); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_generate_v3(namespace uuid, name text) | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_generate_v3$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_generate_v4(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_generate_v4() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_generate_v4$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_generate_v5(uuid, text); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_generate_v5(namespace uuid, name text) | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_generate_v5$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_nil(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_nil() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_nil$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_ns_dns(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_ns_dns() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_ns_dns$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_ns_oid(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_ns_oid() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_ns_oid$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_ns_url(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_ns_url() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_ns_url$function$ | ||||
| ; | ||||
| 
 | ||||
| -- DROP FUNCTION public.uuid_ns_x500(); | ||||
| 
 | ||||
| CREATE OR REPLACE FUNCTION public.uuid_ns_x500() | ||||
|  RETURNS uuid | ||||
|  LANGUAGE c | ||||
|  IMMUTABLE PARALLEL SAFE STRICT | ||||
| AS '$libdir/uuid-ossp', $function$uuid_ns_x500$function$ | ||||
| ; | ||||
| @ -0,0 +1,74 @@ | ||||
| DO $$ | ||||
| 
 | ||||
| DECLARE doc_type_id INTEGER; | ||||
| DECLARE id_type_id INTEGER; | ||||
| 
 | ||||
| BEGIN | ||||
| 	 | ||||
| 	INSERT INTO "LookupData" ("Name") | ||||
| 	VALUES | ||||
| 	('Document Types'), | ||||
| 	('Identification Types'); | ||||
| 	 | ||||
| 
 | ||||
| 	 | ||||
| 	SELECT "LookupDataID" INTO doc_type_id FROM "LookupData" WHERE "Name" = 'Document Types' LIMIT 1; | ||||
| 	 | ||||
| 	-- Now insert into LookupDataValues using the retrieved ID | ||||
| 	INSERT INTO "LookupDataValues" ("LookupDataID", "Value") | ||||
| 	VALUES (doc_type_id, 'Affidavit of Acknowledgement of a Child'), | ||||
| 	        (doc_type_id, 'Affidavit of Undertaking'), | ||||
| 	        (doc_type_id, 'Affidavit of service'), | ||||
| 	        (doc_type_id, 'Affidavits'), | ||||
| 	        (doc_type_id, 'Bid docs'), | ||||
| 	        (doc_type_id, 'Biodata'), | ||||
| 	        (doc_type_id, 'Certification against non-forum shopping'), | ||||
| 	        (doc_type_id, 'Certification of Compliance Officer'), | ||||
| 	        (doc_type_id, 'Contract of Lease'), | ||||
| 	        (doc_type_id, 'Deed of Absolute Sale'), | ||||
| 	        (doc_type_id, 'Deed of Assignment'), | ||||
| 	        (doc_type_id, 'Extrajudicial Partition'), | ||||
| 	        (doc_type_id, 'FCFS/LCFS'), | ||||
| 	        (doc_type_id, 'FCIF/LCIF'), | ||||
| 	        (doc_type_id, 'GIS'), | ||||
| 	        (doc_type_id, 'LGU business permit application form'), | ||||
| 	        (doc_type_id, 'Loan Agreement'), | ||||
| 	        (doc_type_id, 'Personal Data Sheet'), | ||||
| 	        (doc_type_id, 'Proxy forms'), | ||||
| 	        (doc_type_id, 'Quitclaims'), | ||||
| 	        (doc_type_id, 'SALN'), | ||||
| 	        (doc_type_id, 'Secretary’s Certificate'), | ||||
| 	        (doc_type_id, 'Service Agreements'), | ||||
| 	        (doc_type_id, 'Settlement Agreement'), | ||||
| 	        (doc_type_id, 'Special Power of Attorney'), | ||||
| 	        (doc_type_id, 'Verification of pleadings'), | ||||
| 	        (doc_type_id, 'Wills'); | ||||
| 	 | ||||
| 	SELECT "LookupDataID" INTO id_type_id FROM "LookupData" WHERE "Name" = 'Identification Types' LIMIT 1; | ||||
| 	 | ||||
| 	-- Now insert into LookupDataValues using the retrieved ID | ||||
| 	INSERT INTO "LookupDataValues" ("LookupDataID", "Value") | ||||
| 	VALUES (id_type_id, 'Administration (OWWA) ID'), | ||||
| 	        (id_type_id, 'Alien Certificate of Registration'), | ||||
| 	        (id_type_id, 'Certification from the National Council for the Welfare of Disabled Persons (NCWDP)'), | ||||
| 	        (id_type_id, 'Department of Social Welfare and Development (DSWD) certification'), | ||||
| 	        (id_type_id, 'Driver''s license'), | ||||
| 	        (id_type_id, 'Government Office ID'), | ||||
| 	        (id_type_id, 'Government Service and Insurance System (GSIS) e-card'), | ||||
| 	        (id_type_id, 'Immigrant Certificate of Registration'), | ||||
| 	        (id_type_id, 'Integrated Bar of the Philippines (IBP) ID'), | ||||
| 	        (id_type_id, 'National Bureau of Investigation (NBI) clearance'), | ||||
| 	        (id_type_id, 'Overseas Filipino Worker (OFW) ID'), | ||||
| 	        (id_type_id, 'Overseas Workers Welfare Administration (OWWA) ID'), | ||||
| 	        (id_type_id, 'Passport'), | ||||
| 	        (id_type_id, 'PhilHealth card'), | ||||
| 	        (id_type_id, 'Police clearance'), | ||||
| 	        (id_type_id, 'Postal ID'), | ||||
| 	        (id_type_id, 'Professional Regulations Commission (PRC) ID'), | ||||
| 	        (id_type_id, 'Seaman''s book'), | ||||
| 	        (id_type_id, 'Senior citizen card'), | ||||
| 	        (id_type_id, 'Social Security System (SSS) card'), | ||||
| 	        (id_type_id, 'Tax Identification Number (TIN) ID'), | ||||
| 	        (id_type_id, 'Unified Multi-Purpose ID (UMID) Card'), | ||||
| 	        (id_type_id, 'Voter''s ID'); | ||||
| END $$; | ||||
							
								
								
									
										15
									
								
								EnotaryoPH/EnotaryoPH.Web/web.dev.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								EnotaryoPH/EnotaryoPH.Web/web.dev.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <configuration> | ||||
| 	<location path="." inheritInChildApplications="false"> | ||||
| 		<system.webServer> | ||||
| 			<handlers> | ||||
| 				<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> | ||||
| 			</handlers> | ||||
| 			<aspNetCore processPath="dotnet" arguments=".\EnotaryoPH.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> | ||||
| 				<environmentVariables> | ||||
| 					<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> | ||||
| 				</environmentVariables> | ||||
| 			</aspNetCore> | ||||
| 		</system.webServer> | ||||
| 	</location> | ||||
| </configuration> | ||||
							
								
								
									
										15
									
								
								EnotaryoPH/EnotaryoPH.Web/web.local.config
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								EnotaryoPH/EnotaryoPH.Web/web.local.config
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <configuration> | ||||
| 	<location path="." inheritInChildApplications="false"> | ||||
| 		<system.webServer> | ||||
| 			<handlers> | ||||
| 				<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" /> | ||||
| 			</handlers> | ||||
| 			<aspNetCore processPath="dotnet" arguments=".\EnotaryoPH.Web.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess"> | ||||
| 				<environmentVariables> | ||||
| 					<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="Development" /> | ||||
| 				</environmentVariables> | ||||
| 			</aspNetCore> | ||||
| 		</system.webServer> | ||||
| 	</location> | ||||
| </configuration> | ||||
| @ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution | ||||
| 		..\README.md = ..\README.md | ||||
| 	EndProjectSection | ||||
| EndProject | ||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnotaryoPH.DbMigration", "EnotaryoPH.DbMigration\EnotaryoPH.DbMigration.csproj", "{191EA7CD-B89A-4F4B-895A-790A20B20461}" | ||||
| EndProject | ||||
| Global | ||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
| 		Debug|Any CPU = Debug|Any CPU | ||||
| @ -28,6 +30,10 @@ Global | ||||
| 		{7B06785D-1B94-472B-885C-3C2F8834438B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{7B06785D-1B94-472B-885C-3C2F8834438B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{7B06785D-1B94-472B-885C-3C2F8834438B}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 		{191EA7CD-B89A-4F4B-895A-790A20B20461}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||
| 		{191EA7CD-B89A-4F4B-895A-790A20B20461}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||
| 		{191EA7CD-B89A-4F4B-895A-790A20B20461}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
| 		{191EA7CD-B89A-4F4B-895A-790A20B20461}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
| 	EndGlobalSection | ||||
| 	GlobalSection(SolutionProperties) = preSolution | ||||
| 		HideSolutionNode = FALSE | ||||
|  | ||||
| @ -12,13 +12,55 @@ variables: | ||||
|   buildConfiguration: 'Release' | ||||
| 
 | ||||
| pool: | ||||
|   vmImage: 'ubuntu-latest' # This default pool will be used for Linux builds | ||||
|   vmImage: 'ubuntu-latest' | ||||
| 
 | ||||
| stages: | ||||
| - stage: Build | ||||
|   jobs: | ||||
| 
 | ||||
|   - job: SetupEnvironment | ||||
|     displayName: "Setup Build Environment" | ||||
|     steps: | ||||
| 
 | ||||
|     - task: PowerShell@2 | ||||
|       name: "diffStep" | ||||
|       inputs: | ||||
|         targetType: 'inline' | ||||
|         script: | | ||||
|           Write-Host "##[section]All Environment Variables:" | ||||
|           Get-ChildItem env: | Format-Table -AutoSize | ||||
|            | ||||
|           Write-Host "##[section]Specific Variable Example:" | ||||
|           Write-Host "BUILD_SOURCEBRANCH = $env:BUILD_SOURCEBRANCH" | ||||
|           Write-Host "BUILD_REPOSITORY_NAME = $env:BUILD_REPOSITORY_NAME" | ||||
|           git fetch origin "$(Build.SourceBranchName)" main | ||||
|           $diffResult = git diff --name-only origin/main...HEAD | ||||
|           $folderFound = $false | ||||
|           if ([string]::IsNullOrWhiteSpace($diffResult)) { | ||||
|               Write-Host "No diff results found." | ||||
|               Write-Host "##vso[task.setvariable variable=folderChanged;isOutput=true]$folderFound" | ||||
|               exit 0  # Exit with success code | ||||
|           } | ||||
| 
 | ||||
|           $diffResultEncoded = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($diffResult)) | ||||
|           Write-Host "##vso[task.setvariable variable=diffResultEncoded]$diffResultEncoded" | ||||
| 
 | ||||
|           $foldersToCheck = @('EnotaryoPH/EnotaryoPH.DbMigration/Scripts') | ||||
|           foreach ($folder in $foldersToCheck) { | ||||
|               if ($diffResult -match $folder) { | ||||
|                   $folderFound = $true | ||||
|                   Write-Host "Found changes in $folder" | ||||
|                   break | ||||
|               } | ||||
|           } | ||||
|           Write-Host "##vso[task.setvariable variable=folderChanged;isOutput=true]$folderFound" | ||||
|       displayName: 'Check Git Diff for Specific Folders' | ||||
| 
 | ||||
|   - job: LinuxBuild | ||||
|     displayName: 'Build on Linux' | ||||
|     dependsOn: SetupEnvironment | ||||
|     variables: | ||||
|       folderChanged: $[ dependencies.SetupEnvironment.outputs['diffStep.folderChanged'] ] | ||||
|     pool: | ||||
|       vmImage: 'ubuntu-latest' | ||||
|     steps: | ||||
| @ -38,15 +80,42 @@ stages: | ||||
|           filePath: 'make.ps1' | ||||
|           arguments: '-OutputDir $(Build.ArtifactStagingDirectory)-linux' | ||||
| 
 | ||||
|       - task: ArchiveFiles@2 | ||||
|         inputs: | ||||
|           rootFolderOrFile: '$(Build.ArtifactStagingDirectory)-linux/web' | ||||
|           includeRootFolder: true | ||||
|           archiveType: 'zip' | ||||
|           archiveFile: '$(Build.ArtifactStagingDirectory)-linux/$(Build.BuildId)/web.zip' | ||||
|           replaceExistingArchive: true | ||||
| 
 | ||||
|       - task: PublishBuildArtifacts@1 | ||||
|         inputs: | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)-linux' | ||||
|           ArtifactName: 'drop-linux' | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)-linux/$(Build.BuildId)/web.zip' | ||||
|           ArtifactName: 'drop-linux-web' | ||||
|           publishLocation: 'Container' | ||||
| 
 | ||||
|       - task: ArchiveFiles@2 | ||||
|         condition: eq(variables['folderChanged'], 'True') | ||||
|         inputs: | ||||
|           rootFolderOrFile: '$(Build.ArtifactStagingDirectory)-linux/migration' | ||||
|           includeRootFolder: true | ||||
|           archiveType: 'zip' | ||||
|           archiveFile: '$(Build.ArtifactStagingDirectory)-linux/$(Build.BuildId)/migration.zip' | ||||
|           replaceExistingArchive: true | ||||
| 
 | ||||
|       - task: PublishBuildArtifacts@1 | ||||
|         condition: eq(variables['folderChanged'], 'True') | ||||
|         inputs: | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId)/migration.zip' | ||||
|           ArtifactName: 'drop-linux-migration' | ||||
|           publishLocation: 'Container' | ||||
| 
 | ||||
|   - job: WindowsBuild | ||||
|     displayName: 'Build on Windows' | ||||
|     dependsOn: SetupEnvironment | ||||
|     condition: ne(variables['Build.Reason'], 'PullRequest') | ||||
|     variables: | ||||
|       folderChanged: $[ dependencies.SetupEnvironment.outputs['diffStep.folderChanged'] ] | ||||
|     pool: | ||||
|       vmImage: 'windows-latest' # Specify the Windows agent | ||||
|     steps: | ||||
| @ -66,10 +135,33 @@ stages: | ||||
|           filePath: 'make.ps1' | ||||
|           arguments: '-OutputDir $(Build.ArtifactStagingDirectory)-windows' | ||||
| 
 | ||||
|       - task: ArchiveFiles@2 | ||||
|         inputs: | ||||
|           rootFolderOrFile: '$(Build.ArtifactStagingDirectory)-windows/web' | ||||
|           includeRootFolder: true | ||||
|           archiveType: 'zip' | ||||
|           archiveFile: '$(Build.ArtifactStagingDirectory)-windows/$(Build.BuildId)/web.zip' | ||||
|           replaceExistingArchive: true | ||||
|       - task: PublishBuildArtifacts@1 | ||||
|         inputs: | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)-windows' | ||||
|           ArtifactName: 'drop-windows' | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)-windows/$(Build.BuildId)/web.zip' | ||||
|           ArtifactName: 'drop-windows-web' | ||||
|           publishLocation: 'Container' | ||||
| 
 | ||||
|       - task: ArchiveFiles@2 | ||||
|         condition: eq(variables['folderChanged'], 'True') | ||||
|         inputs: | ||||
|           rootFolderOrFile: '$(Build.ArtifactStagingDirectory)-windows/migration' | ||||
|           includeRootFolder: true | ||||
|           archiveType: 'zip' | ||||
|           archiveFile: '$(Build.ArtifactStagingDirectory)-windows/$(Build.BuildId)/migration.zip' | ||||
|           replaceExistingArchive: true | ||||
| 
 | ||||
|       - task: PublishBuildArtifacts@1 | ||||
|         condition: eq(variables['folderChanged'], 'True') | ||||
|         inputs: | ||||
|           PathtoPublish: '$(Build.ArtifactStagingDirectory)-windows/$(Build.BuildId)/migration.zip' | ||||
|           ArtifactName: 'drop-windows-migration' | ||||
|           publishLocation: 'Container' | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										8
									
								
								make.ps1
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								make.ps1
									
									
									
									
									
								
							| @ -4,11 +4,15 @@ param( | ||||
|     $OutputDir | ||||
| ) | ||||
| 
 | ||||
| 
 | ||||
| Remove-Item -Path $OutputDir -Recurse -Force -ErrorAction SilentlyContinue | ||||
| 
 | ||||
| dotnet publish .\EnotaryoPH\EnotaryoPH.DbMigration\EnotaryoPH.DbMigration.csproj --nologo --output "$OutputDir\migration" | ||||
| 
 | ||||
| cd EnotaryoPH/EnotaryoPH.Web | ||||
| npm install --production | ||||
| 
 | ||||
| dotnet publish EnotaryoPH.Web.csproj --nologo --output $OutputDir | ||||
| 
 | ||||
| dotnet publish EnotaryoPH.Web.csproj --nologo --output "$OutputDir\web" | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user