Eisgnature Migrations, webhook handling, and clean up.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
DROP TABLE "public"."esignature_documents";
|
||||
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE "public"."esignature_documents" ("id" uuid NOT NULL DEFAULT gen_random_uuid(), "created_at" timestamptz NOT NULL DEFAULT now(), "updated_at" timestamptz NOT NULL DEFAULT now(), "external_document_id" text NOT NULL, "jobid" uuid NOT NULL, "status" text NOT NULL, "recipients" jsonb[] NOT NULL, "title" text NOT NULL, "subject" text NOT NULL, "message" text NOT NULL, "viewed" boolean NOT NULL DEFAULT false, "completed" boolean NOT NULL DEFAULT false, "documentid" uuid, "rejected" boolean NOT NULL DEFAULT false, "opened" boolean NOT NULL DEFAULT false, PRIMARY KEY ("id") , FOREIGN KEY ("jobid") REFERENCES "public"."jobs"("id") ON UPDATE restrict ON DELETE restrict);COMMENT ON TABLE "public"."esignature_documents" IS E'Tracking the lifecycle of esignature documents. ';
|
||||
CREATE OR REPLACE FUNCTION "public"."set_current_timestamp_updated_at"()
|
||||
RETURNS TRIGGER AS $$
|
||||
DECLARE
|
||||
_new record;
|
||||
BEGIN
|
||||
_new := NEW;
|
||||
_new."updated_at" = NOW();
|
||||
RETURN _new;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE TRIGGER "set_public_esignature_documents_updated_at"
|
||||
BEFORE UPDATE ON "public"."esignature_documents"
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE "public"."set_current_timestamp_updated_at"();
|
||||
COMMENT ON TRIGGER "set_public_esignature_documents_updated_at" ON "public"."esignature_documents"
|
||||
IS 'trigger to set value of column "updated_at" to current timestamp on row update';
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."esignature_documents" drop constraint "esignature_documents_documentid_fkey";
|
||||
@@ -0,0 +1,5 @@
|
||||
alter table "public"."esignature_documents"
|
||||
add constraint "esignature_documents_documentid_fkey"
|
||||
foreign key ("documentid")
|
||||
references "public"."documents"
|
||||
("id") on update restrict on delete restrict;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE "public"."esignature_documents" ALTER COLUMN "recipients" TYPE ARRAY;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TABLE "public"."esignature_documents" ALTER COLUMN "recipients" TYPE json[];
|
||||
@@ -0,0 +1,4 @@
|
||||
-- Could not auto-generate a down migration.
|
||||
-- Please write an appropriate down migration for the SQL below:
|
||||
-- alter table "public"."esignature_documents" add column "completed_at" timestamptz
|
||||
-- null;
|
||||
@@ -0,0 +1,2 @@
|
||||
alter table "public"."esignature_documents" add column "completed_at" timestamptz
|
||||
null;
|
||||
@@ -0,0 +1,4 @@
|
||||
comment on column "public"."esignature_documents"."viewed" is E'Tracking the lifecycle of esignature documents. ';
|
||||
alter table "public"."esignature_documents" alter column "viewed" set default false;
|
||||
alter table "public"."esignature_documents" alter column "viewed" drop not null;
|
||||
alter table "public"."esignature_documents" add column "viewed" bool;
|
||||
@@ -0,0 +1 @@
|
||||
alter table "public"."esignature_documents" drop column "viewed" cascade;
|
||||
Reference in New Issue
Block a user