wip: what if user ids were strings instead of numbers

This commit is contained in:
Mythie
2025-01-03 16:23:35 +11:00
parent 18ca0cf3d6
commit b685190b1a
134 changed files with 775 additions and 246 deletions

View File

@ -0,0 +1,94 @@
-- !: This needs to run first
-- AlterTable
ALTER TABLE "User" ADD COLUMN "secondaryId" TEXT;
-- Set all null secondaryId users to a uuid
UPDATE "User" SET "secondaryId" = gen_random_uuid()::text WHERE "secondaryId" IS NULL;
-- Restrict the secondaryId to required
ALTER TABLE "User" ALTER COLUMN "secondaryId" SET NOT NULL;
-- Now lets update all the tables that reference the user table to use the secondaryId
-- AlterTable
ALTER TABLE "Account" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Account" a SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = a."userId");
-- AlterTable
ALTER TABLE "ApiToken" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "ApiToken" a SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = a."userId");
-- AlterTable
ALTER TABLE "Document" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Document" d SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = d."userId");
-- AlterTable
ALTER TABLE "Passkey" ADD COLUMN "secondaryUserId" TEXT NOT NULL;
UPDATE "Passkey" p SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = p."userId");
-- AlterTable
ALTER TABLE "PasswordResetToken" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "PasswordResetToken" p SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = p."userId");
-- AlterTable
ALTER TABLE "Session" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Session" s SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = s."userId");
-- AlterTable
ALTER TABLE "SiteSettings" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "SiteSettings" s SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = s."lastModifiedByUserId");
-- AlterTable
ALTER TABLE "Subscription" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Subscription" s SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = s."userId");
-- AlterTable
ALTER TABLE "Team" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Team" t SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = t."ownerUserId");
-- AlterTable
ALTER TABLE "TeamMember" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "TeamMember" tm SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = tm."userId");
-- AlterTable
ALTER TABLE "TeamPending" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "TeamPending" tp SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = tp."ownerUserId");
-- AlterTable
ALTER TABLE "Template" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Template" t SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = t."userId");
-- AlterTable
ALTER TABLE "UserProfile" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "UserProfile" up SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = up."userId");
-- AlterTable
ALTER TABLE "UserSecurityAuditLog" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "UserSecurityAuditLog" usal SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = usal."userId");
-- AlterTable
ALTER TABLE "VerificationToken" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "VerificationToken" vt SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = vt."userId");
-- AlterTable
ALTER TABLE "Webhook" ADD COLUMN "secondaryUserId" TEXT;
UPDATE "Webhook" w SET "secondaryUserId" = (SELECT "secondaryId" FROM "User" u WHERE u."id" = w."userId");
-- CreateIndex
CREATE UNIQUE INDEX "User_secondaryId_key" ON "User"("secondaryId");

View File

@ -0,0 +1,199 @@
/*
Warnings:
- You are about to drop the column `secondaryUserId` on the `Account` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `ApiToken` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Document` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Passkey` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `PasswordResetToken` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Session` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `SiteSettings` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Subscription` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Team` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `TeamMember` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `TeamPending` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Template` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `UserProfile` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `UserSecurityAuditLog` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `VerificationToken` table. All the data in the column will be lost.
- You are about to drop the column `secondaryUserId` on the `Webhook` table. All the data in the column will be lost.
*/
-- DropForeignKey
ALTER TABLE "Account" DROP CONSTRAINT "Account_userId_fkey";
-- DropForeignKey
ALTER TABLE "ApiToken" DROP CONSTRAINT "ApiToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Document" DROP CONSTRAINT "Document_userId_fkey";
-- DropForeignKey
ALTER TABLE "Passkey" DROP CONSTRAINT "Passkey_userId_fkey";
-- DropForeignKey
ALTER TABLE "PasswordResetToken" DROP CONSTRAINT "PasswordResetToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- DropForeignKey
ALTER TABLE "SiteSettings" DROP CONSTRAINT "SiteSettings_lastModifiedByUserId_fkey";
-- DropForeignKey
ALTER TABLE "Subscription" DROP CONSTRAINT "Subscription_userId_fkey";
-- DropForeignKey
ALTER TABLE "Team" DROP CONSTRAINT "Team_ownerUserId_fkey";
-- DropForeignKey
ALTER TABLE "TeamMember" DROP CONSTRAINT "TeamMember_userId_fkey";
-- DropForeignKey
ALTER TABLE "TeamPending" DROP CONSTRAINT "TeamPending_ownerUserId_fkey";
-- DropForeignKey
ALTER TABLE "Template" DROP CONSTRAINT "Template_userId_fkey";
-- DropForeignKey
ALTER TABLE "UserProfile" DROP CONSTRAINT "UserProfile_userId_fkey";
-- DropForeignKey
ALTER TABLE "UserSecurityAuditLog" DROP CONSTRAINT "UserSecurityAuditLog_userId_fkey";
-- DropForeignKey
ALTER TABLE "VerificationToken" DROP CONSTRAINT "VerificationToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Webhook" DROP CONSTRAINT "Webhook_userId_fkey";
-- AlterTable
ALTER TABLE "Account" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Account" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Account" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "ApiToken" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "ApiToken" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "ApiToken" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "Document" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Document" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Document" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "Passkey" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Passkey" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Passkey" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "PasswordResetToken" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "PasswordResetToken" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "PasswordResetToken" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "Session" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Session" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Session" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "SiteSettings" RENAME COLUMN "lastModifiedByUserId" TO "lastModifiedByUserId_old";
ALTER TABLE "SiteSettings" RENAME COLUMN "secondaryUserId" TO "lastModifiedByUserId";
ALTER TABLE "SiteSettings" DROP COLUMN "lastModifiedByUserId_old";
-- AlterTable
ALTER TABLE "Subscription" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Subscription" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Subscription" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "Team" RENAME COLUMN "ownerUserId" TO "ownerUserId_old";
ALTER TABLE "Team" RENAME COLUMN "secondaryUserId" TO "ownerUserId";
ALTER TABLE "Team" DROP COLUMN "ownerUserId_old";
-- AlterTable
ALTER TABLE "TeamMember" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "TeamMember" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "TeamMember" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "TeamPending" RENAME COLUMN "ownerUserId" TO "ownerUserId_old";
ALTER TABLE "TeamPending" RENAME COLUMN "secondaryUserId" TO "ownerUserId";
ALTER TABLE "TeamPending" DROP COLUMN "ownerUserId_old";
-- AlterTable
ALTER TABLE "Template" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Template" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Template" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "UserProfile" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "UserProfile" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "UserProfile" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "UserSecurityAuditLog" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "UserSecurityAuditLog" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "UserSecurityAuditLog" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "VerificationToken" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "VerificationToken" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "VerificationToken" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "Webhook" RENAME COLUMN "userId" TO "userId_old";
ALTER TABLE "Webhook" RENAME COLUMN "secondaryUserId" TO "userId";
ALTER TABLE "Webhook" DROP COLUMN "userId_old";
-- AlterTable
ALTER TABLE "TeamTransferVerification" ALTER COLUMN "userId" SET DATA TYPE TEXT;
-- AddForeignKey
ALTER TABLE "UserProfile" ADD CONSTRAINT "UserProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserSecurityAuditLog" ADD CONSTRAINT "UserSecurityAuditLog_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PasswordResetToken" ADD CONSTRAINT "PasswordResetToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Passkey" ADD CONSTRAINT "Passkey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "VerificationToken" ADD CONSTRAINT "VerificationToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Webhook" ADD CONSTRAINT "Webhook_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ApiToken" ADD CONSTRAINT "ApiToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Subscription" ADD CONSTRAINT "Subscription_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Document" ADD CONSTRAINT "Document_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Team" ADD CONSTRAINT "Team_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TeamPending" ADD CONSTRAINT "TeamPending_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TeamMember" ADD CONSTRAINT "TeamMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Template" ADD CONSTRAINT "Template_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("secondaryId") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SiteSettings" ADD CONSTRAINT "SiteSettings_lastModifiedByUserId_fkey" FOREIGN KEY ("lastModifiedByUserId") REFERENCES "User"("secondaryId") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -0,0 +1,66 @@
/*
Warnings:
- A unique constraint covering the columns `[userId,teamId]` on the table `TeamMember` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[userId]` on the table `UserProfile` will be added. If there are existing duplicate values, this will fail.
- Made the column `userId` on table `Account` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `Document` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `PasswordResetToken` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `Session` required. This step will fail if there are existing NULL values in that column.
- Made the column `ownerUserId` on table `Team` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `TeamMember` required. This step will fail if there are existing NULL values in that column.
- Made the column `ownerUserId` on table `TeamPending` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `Template` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `UserProfile` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `UserSecurityAuditLog` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `VerificationToken` required. This step will fail if there are existing NULL values in that column.
- Made the column `userId` on table `Webhook` required. This step will fail if there are existing NULL values in that column.
*/
-- AlterTable
ALTER TABLE "Account" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "Document" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "PasswordResetToken" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "Session" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "Team" ALTER COLUMN "ownerUserId" SET NOT NULL;
-- AlterTable
ALTER TABLE "TeamMember" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "TeamPending" ALTER COLUMN "ownerUserId" SET NOT NULL;
-- AlterTable
ALTER TABLE "Template" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "UserProfile" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "UserSecurityAuditLog" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "VerificationToken" ALTER COLUMN "userId" SET NOT NULL;
-- AlterTable
ALTER TABLE "Webhook" ALTER COLUMN "userId" SET NOT NULL;
-- CreateIndex
CREATE INDEX "Document_userId_idx" ON "Document"("userId");
-- CreateIndex
CREATE INDEX "Subscription_userId_idx" ON "Subscription"("userId");
-- CreateIndex
CREATE UNIQUE INDEX "TeamMember_userId_teamId_key" ON "TeamMember"("userId", "teamId");
-- CreateIndex
CREATE UNIQUE INDEX "UserProfile_userId_key" ON "UserProfile"("userId");

View File

@ -0,0 +1,123 @@
/*
Warnings:
- The primary key for the `User` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `secondaryId` on the `User` table. All the data in the column will be lost.
- A unique constraint covering the columns `[id]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- DropForeignKey
ALTER TABLE "Account" DROP CONSTRAINT "Account_userId_fkey";
-- DropForeignKey
ALTER TABLE "ApiToken" DROP CONSTRAINT "ApiToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Document" DROP CONSTRAINT "Document_userId_fkey";
-- DropForeignKey
ALTER TABLE "Passkey" DROP CONSTRAINT "Passkey_userId_fkey";
-- DropForeignKey
ALTER TABLE "PasswordResetToken" DROP CONSTRAINT "PasswordResetToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Session" DROP CONSTRAINT "Session_userId_fkey";
-- DropForeignKey
ALTER TABLE "SiteSettings" DROP CONSTRAINT "SiteSettings_lastModifiedByUserId_fkey";
-- DropForeignKey
ALTER TABLE "Subscription" DROP CONSTRAINT "Subscription_userId_fkey";
-- DropForeignKey
ALTER TABLE "Team" DROP CONSTRAINT "Team_ownerUserId_fkey";
-- DropForeignKey
ALTER TABLE "TeamMember" DROP CONSTRAINT "TeamMember_userId_fkey";
-- DropForeignKey
ALTER TABLE "TeamPending" DROP CONSTRAINT "TeamPending_ownerUserId_fkey";
-- DropForeignKey
ALTER TABLE "Template" DROP CONSTRAINT "Template_userId_fkey";
-- DropForeignKey
ALTER TABLE "UserProfile" DROP CONSTRAINT "UserProfile_userId_fkey";
-- DropForeignKey
ALTER TABLE "UserSecurityAuditLog" DROP CONSTRAINT "UserSecurityAuditLog_userId_fkey";
-- DropForeignKey
ALTER TABLE "VerificationToken" DROP CONSTRAINT "VerificationToken_userId_fkey";
-- DropForeignKey
ALTER TABLE "Webhook" DROP CONSTRAINT "Webhook_userId_fkey";
-- DropIndex
DROP INDEX "User_secondaryId_key";
-- AlterTable
ALTER TABLE "User" DROP CONSTRAINT "User_pkey";
-- Rename the id column to id_old
ALTER TABLE "User" ALTER COLUMN "id" SET DATA TYPE TEXT;
ALTER TABLE "User" ALTER COLUMN "id" DROP DEFAULT;
ALTER TABLE "User" RENAME COLUMN "id" TO "id_old";
-- Rename the secondaryId column to id
ALTER TABLE "User" RENAME COLUMN "secondaryId" TO "id";
-- Drop the id_old column
ALTER TABLE "User" DROP COLUMN "id_old";
-- CreateIndex
CREATE UNIQUE INDEX "User_id_key" ON "User"("id");
-- AddForeignKey
ALTER TABLE "UserProfile" ADD CONSTRAINT "UserProfile_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "UserSecurityAuditLog" ADD CONSTRAINT "UserSecurityAuditLog_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "PasswordResetToken" ADD CONSTRAINT "PasswordResetToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Passkey" ADD CONSTRAINT "Passkey_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "VerificationToken" ADD CONSTRAINT "VerificationToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Webhook" ADD CONSTRAINT "Webhook_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "ApiToken" ADD CONSTRAINT "ApiToken_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Subscription" ADD CONSTRAINT "Subscription_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Document" ADD CONSTRAINT "Document_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Team" ADD CONSTRAINT "Team_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TeamPending" ADD CONSTRAINT "TeamPending_ownerUserId_fkey" FOREIGN KEY ("ownerUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "TeamMember" ADD CONSTRAINT "TeamMember_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Template" ADD CONSTRAINT "Template_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "SiteSettings" ADD CONSTRAINT "SiteSettings_lastModifiedByUserId_fkey" FOREIGN KEY ("lastModifiedByUserId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE;

View File

@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# It should be added in your version-control system (e.g., Git)
provider = "postgresql"