mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 09:54:51 +10:00
Merge remote-tracking branch 'origin/main' into pr-2468
# Conflicts: # packages/lib/types/document-audit-logs.ts # packages/lib/utils/document-audit-logs.ts # packages/prisma/schema.prisma
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
-- AlterTable
|
||||
-- Add the column with a temporary DEFAULT so Postgres backfills existing rows
|
||||
-- to 'SES' (the only level the instance supported before this migration). The
|
||||
-- DEFAULT is then dropped so future INSERTs must specify signatureLevel
|
||||
-- explicitly via resolveSignatureLevel — the column carries no DB-level default
|
||||
-- by design (see packages/lib/server-only/signature-level/resolve-signature-level.ts).
|
||||
ALTER TABLE "Envelope" ADD COLUMN "signatureLevel" TEXT NOT NULL DEFAULT 'SES';
|
||||
ALTER TABLE "Envelope" ALTER COLUMN "signatureLevel" DROP DEFAULT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "CscCredential" (
|
||||
"id" TEXT NOT NULL,
|
||||
"providerId" TEXT NOT NULL,
|
||||
"credentialId" TEXT NOT NULL,
|
||||
"certCache" BYTEA,
|
||||
"signatureAlgorithm" TEXT NOT NULL,
|
||||
"keyType" TEXT NOT NULL,
|
||||
"digestAlgorithm" TEXT NOT NULL,
|
||||
"keyLenBits" INTEGER,
|
||||
"signAlgoParams" TEXT,
|
||||
"serviceTokenCiphertext" BYTEA,
|
||||
"serviceTokenExpiresAt" TIMESTAMP(3),
|
||||
"recipientId" INTEGER NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "CscCredential_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "CscSession" (
|
||||
"id" TEXT NOT NULL,
|
||||
"envelopeId" TEXT NOT NULL,
|
||||
"signingTime" TIMESTAMP(3) NOT NULL,
|
||||
"itemsJson" JSONB NOT NULL,
|
||||
"encryptedSad" BYTEA,
|
||||
"sadExpiresAt" TIMESTAMP(3),
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"recipientId" INTEGER NOT NULL,
|
||||
|
||||
CONSTRAINT "CscSession_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "CscCredential_recipientId_key" ON "CscCredential"("recipientId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "CscSession_recipientId_key" ON "CscSession"("recipientId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "CscCredential" ADD CONSTRAINT "CscCredential_recipientId_fkey" FOREIGN KEY ("recipientId") REFERENCES "Recipient"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "CscSession" ADD CONSTRAINT "CscSession_recipientId_fkey" FOREIGN KEY ("recipientId") REFERENCES "Recipient"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,52 @@
|
||||
-- AlterTable
|
||||
-- Add the new columns with temporary defaults to backfill existing rows, then
|
||||
-- drop the defaults so the columns match the schema (required, no default).
|
||||
ALTER TABLE "OrganisationClaim" ADD COLUMN "apiQuota" INTEGER,
|
||||
ADD COLUMN "apiRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "documentQuota" INTEGER,
|
||||
ADD COLUMN "documentRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "emailQuota" INTEGER,
|
||||
ADD COLUMN "emailRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "recipientCount" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE "OrganisationClaim" ALTER COLUMN "apiRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "documentRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "emailRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "recipientCount" DROP DEFAULT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SubscriptionClaim" ADD COLUMN "apiQuota" INTEGER,
|
||||
ADD COLUMN "apiRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "documentQuota" INTEGER,
|
||||
ADD COLUMN "documentRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "emailQuota" INTEGER,
|
||||
ADD COLUMN "emailRateLimits" JSONB NOT NULL DEFAULT '[]'::jsonb,
|
||||
ADD COLUMN "recipientCount" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE "SubscriptionClaim" ALTER COLUMN "apiRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "documentRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "emailRateLimits" DROP DEFAULT,
|
||||
ALTER COLUMN "recipientCount" DROP DEFAULT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "OrganisationMonthlyStat" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"organisationId" TEXT NOT NULL,
|
||||
"period" TEXT NOT NULL,
|
||||
"documentCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"emailCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"apiCount" INTEGER NOT NULL DEFAULT 0,
|
||||
|
||||
CONSTRAINT "OrganisationMonthlyStat_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "OrganisationMonthlyStat_organisationId_idx" ON "OrganisationMonthlyStat"("organisationId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "OrganisationMonthlyStat_organisationId_period_key" ON "OrganisationMonthlyStat"("organisationId", "period");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "OrganisationMonthlyStat" ADD CONSTRAINT "OrganisationMonthlyStat_organisationId_fkey" FOREIGN KEY ("organisationId") REFERENCES "Organisation"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "OrganisationMonthlyStat" ADD COLUMN "emailReports" INTEGER NOT NULL DEFAULT 0;
|
||||
@@ -0,0 +1,28 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "EmailTransportType" AS ENUM ('SMTP_AUTH', 'SMTP_API', 'RESEND', 'MAILCHANNELS');
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "OrganisationClaim" ADD COLUMN "emailTransportId" TEXT;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SubscriptionClaim" ADD COLUMN "emailTransportId" TEXT;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "EmailTransport" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"type" "EmailTransportType" NOT NULL,
|
||||
"fromName" TEXT NOT NULL,
|
||||
"fromAddress" TEXT NOT NULL,
|
||||
"config" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "EmailTransport_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "SubscriptionClaim" ADD CONSTRAINT "SubscriptionClaim_emailTransportId_fkey" FOREIGN KEY ("emailTransportId") REFERENCES "EmailTransport"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "OrganisationClaim" ADD CONSTRAINT "OrganisationClaim_emailTransportId_fkey" FOREIGN KEY ("emailTransportId") REFERENCES "EmailTransport"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1 @@
|
||||
ALTER TYPE "DocumentStatus" ADD VALUE 'CANCELLED';
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "Recipient" ADD COLUMN "reminderCount" INTEGER NOT NULL DEFAULT 0;
|
||||
Reference in New Issue
Block a user