configure and implement DbUp related stuff
This commit is contained in:
parent
178de6c531
commit
288ac6db3e
@ -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 $$;
|
@ -14,6 +14,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
..\README.md = ..\README.md
|
..\README.md = ..\README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnotaryoPH.DbMigration", "EnotaryoPH.DbMigration\EnotaryoPH.DbMigration.csproj", "{191EA7CD-B89A-4F4B-895A-790A20B20461}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{7B06785D-1B94-472B-885C-3C2F8834438B}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user