mirror of
https://github.com/documenso/documenso.git
synced 2025-11-21 04:01:45 +10:00
This PR is handles the changes required to support envelopes. The new envelope editor/signing page will be hidden during release. The core changes here is to migrate the documents and templates model to a centralized envelopes model. Even though Documents and Templates are removed, from the user perspective they will still exist as we remap envelopes to documents and templates.
58 lines
1.3 KiB
SQL
58 lines
1.3 KiB
SQL
-- DropForeignKey
|
|
ALTER TABLE "TemplateMeta" DROP CONSTRAINT "TemplateMeta_templateId_fkey";
|
|
|
|
-- AlterTable
|
|
ALTER TABLE "DocumentMeta" ADD COLUMN "templateId" INTEGER,
|
|
ALTER COLUMN "documentId" DROP NOT NULL;
|
|
|
|
-- [CUSTOM_CHANGE] Migrate existing TemplateMeta to DocumentMeta
|
|
INSERT INTO "DocumentMeta" (
|
|
"id",
|
|
"subject",
|
|
"message",
|
|
"timezone",
|
|
"password",
|
|
"dateFormat",
|
|
"redirectUrl",
|
|
"signingOrder",
|
|
"allowDictateNextSigner",
|
|
"typedSignatureEnabled",
|
|
"uploadSignatureEnabled",
|
|
"drawSignatureEnabled",
|
|
"language",
|
|
"distributionMethod",
|
|
"emailSettings",
|
|
"emailReplyTo",
|
|
"emailId",
|
|
"templateId"
|
|
)
|
|
SELECT
|
|
gen_random_uuid()::text, -- Generate new CUID-like IDs to avoid collisions
|
|
"subject",
|
|
"message",
|
|
"timezone",
|
|
"password",
|
|
"dateFormat",
|
|
"redirectUrl",
|
|
"signingOrder",
|
|
"allowDictateNextSigner",
|
|
"typedSignatureEnabled",
|
|
"uploadSignatureEnabled",
|
|
"drawSignatureEnabled",
|
|
"language",
|
|
"distributionMethod",
|
|
"emailSettings",
|
|
"emailReplyTo",
|
|
"emailId",
|
|
"templateId"
|
|
FROM "TemplateMeta";
|
|
|
|
-- DropTable
|
|
DROP TABLE "TemplateMeta";
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "DocumentMeta_templateId_key" ON "DocumentMeta"("templateId");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "DocumentMeta" ADD CONSTRAINT "DocumentMeta_templateId_fkey" FOREIGN KEY ("templateId") REFERENCES "Template"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|