From 58cd284a844db77942a52bdcb9edf151e66f9a5b Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sun, 14 Apr 2024 00:37:06 -1000 Subject: [PATCH] Delete old Prisma folder --- .../20231119002951_init/migration.sql | 286 ------------------ .../migration.sql | 22 -- .../migration.sql | 20 -- .../20231202001242_add_source/migration.sql | 2 - .../20231206215508_add_openid/migration.sql | 20 -- .../migration.sql | 12 - .../migration.sql | 8 - .../migration.sql | 40 --- .../migration.sql | 76 ----- .../migration.sql | 5 - .../migration.sql | 8 - prisma/migrations/migration_lock.toml | 3 - prisma/schema.prisma | 278 ----------------- 13 files changed, 780 deletions(-) delete mode 100644 prisma/migrations/20231119002951_init/migration.sql delete mode 100644 prisma/migrations/20231123022010_add_attachments/migration.sql delete mode 100644 prisma/migrations/20231127010521_add_notifications/migration.sql delete mode 100644 prisma/migrations/20231202001242_add_source/migration.sql delete mode 100644 prisma/migrations/20231206215508_add_openid/migration.sql delete mode 100644 prisma/migrations/20231206231959_add_issuer_and_client_to_flows/migration.sql delete mode 100644 prisma/migrations/20231206232131_make_client_id_unique/migration.sql delete mode 100644 prisma/migrations/20240304012450_add_moderation_data/migration.sql delete mode 100644 prisma/migrations/20240304042832_rework_moderation/migration.sql delete mode 100644 prisma/migrations/20240409042719_make_uri_nullable/migration.sql delete mode 100644 prisma/migrations/20240410091400_drop_is_reblog/migration.sql delete mode 100644 prisma/migrations/migration_lock.toml delete mode 100644 prisma/schema.prisma diff --git a/prisma/migrations/20231119002951_init/migration.sql b/prisma/migrations/20231119002951_init/migration.sql deleted file mode 100644 index 9b9c179b..00000000 --- a/prisma/migrations/20231119002951_init/migration.sql +++ /dev/null @@ -1,286 +0,0 @@ --- CreateExtension -CREATE EXTENSION IF NOT EXISTS "pg_uuidv7"; - --- CreateTable -CREATE TABLE "Application" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "name" TEXT NOT NULL, - "website" TEXT, - "vapid_key" TEXT, - "client_id" TEXT NOT NULL, - "secret" TEXT NOT NULL, - "scopes" TEXT NOT NULL, - "redirect_uris" TEXT NOT NULL, - - CONSTRAINT "Application_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Emoji" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "shortcode" TEXT NOT NULL, - "url" TEXT NOT NULL, - "visible_in_picker" BOOLEAN NOT NULL, - "instanceId" UUID, - "alt" TEXT, - "content_type" TEXT NOT NULL, - - CONSTRAINT "Emoji_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Instance" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "base_url" TEXT NOT NULL, - "name" TEXT NOT NULL, - "version" TEXT NOT NULL, - "logo" JSONB NOT NULL, - - CONSTRAINT "Instance_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Like" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "likerId" UUID NOT NULL, - "likedId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "Like_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "LysandObject" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "remote_id" TEXT NOT NULL, - "type" TEXT NOT NULL, - "uri" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "authorId" UUID, - "extra_data" JSONB NOT NULL, - "extensions" JSONB NOT NULL, - - CONSTRAINT "LysandObject_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Relationship" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "ownerId" UUID NOT NULL, - "subjectId" UUID NOT NULL, - "following" BOOLEAN NOT NULL, - "showingReblogs" BOOLEAN NOT NULL, - "notifying" BOOLEAN NOT NULL, - "followedBy" BOOLEAN NOT NULL, - "blocking" BOOLEAN NOT NULL, - "blockedBy" BOOLEAN NOT NULL, - "muting" BOOLEAN NOT NULL, - "mutingNotifications" BOOLEAN NOT NULL, - "requested" BOOLEAN NOT NULL, - "domainBlocking" BOOLEAN NOT NULL, - "endorsed" BOOLEAN NOT NULL, - "languages" TEXT[], - "note" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "Relationship_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Status" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "uri" TEXT NOT NULL, - "authorId" UUID NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "reblogId" UUID, - "isReblog" BOOLEAN NOT NULL, - "content" TEXT NOT NULL DEFAULT '', - "contentType" TEXT NOT NULL DEFAULT 'text/plain', - "visibility" TEXT NOT NULL, - "inReplyToPostId" UUID, - "quotingPostId" UUID, - "instanceId" UUID, - "sensitive" BOOLEAN NOT NULL, - "spoilerText" TEXT NOT NULL DEFAULT '', - "applicationId" UUID, - - CONSTRAINT "Status_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Token" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "token_type" TEXT NOT NULL, - "scope" TEXT NOT NULL, - "access_token" TEXT NOT NULL, - "code" TEXT NOT NULL, - "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "userId" UUID, - "applicationId" UUID, - - CONSTRAINT "Token_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "User" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "uri" TEXT NOT NULL, - "username" TEXT NOT NULL, - "displayName" TEXT NOT NULL, - "password" TEXT, - "email" TEXT, - "note" TEXT NOT NULL DEFAULT '', - "isAdmin" BOOLEAN NOT NULL DEFAULT false, - "endpoints" JSONB, - "source" JSONB NOT NULL, - "avatar" TEXT NOT NULL, - "header" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - "isBot" BOOLEAN NOT NULL DEFAULT false, - "isLocked" BOOLEAN NOT NULL DEFAULT false, - "isDiscoverable" BOOLEAN NOT NULL DEFAULT false, - "sanctions" TEXT[] DEFAULT ARRAY[]::TEXT[], - "publicKey" TEXT NOT NULL, - "privateKey" TEXT, - "instanceId" UUID, - - CONSTRAINT "User_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "_EmojiToUser" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL -); - --- CreateTable -CREATE TABLE "_EmojiToStatus" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL -); - --- CreateTable -CREATE TABLE "_StatusToUser" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL -); - --- CreateTable -CREATE TABLE "_UserPinnedNotes" ( - "A" UUID NOT NULL, - "B" UUID NOT NULL -); - --- CreateIndex -CREATE UNIQUE INDEX "LysandObject_remote_id_key" ON "LysandObject"("remote_id"); - --- CreateIndex -CREATE UNIQUE INDEX "LysandObject_uri_key" ON "LysandObject"("uri"); - --- CreateIndex -CREATE UNIQUE INDEX "Status_uri_key" ON "Status"("uri"); - --- CreateIndex -CREATE UNIQUE INDEX "User_uri_key" ON "User"("uri"); - --- CreateIndex -CREATE UNIQUE INDEX "User_username_key" ON "User"("username"); - --- CreateIndex -CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); - --- CreateIndex -CREATE UNIQUE INDEX "_EmojiToUser_AB_unique" ON "_EmojiToUser"("A", "B"); - --- CreateIndex -CREATE INDEX "_EmojiToUser_B_index" ON "_EmojiToUser"("B"); - --- CreateIndex -CREATE UNIQUE INDEX "_EmojiToStatus_AB_unique" ON "_EmojiToStatus"("A", "B"); - --- CreateIndex -CREATE INDEX "_EmojiToStatus_B_index" ON "_EmojiToStatus"("B"); - --- CreateIndex -CREATE UNIQUE INDEX "_StatusToUser_AB_unique" ON "_StatusToUser"("A", "B"); - --- CreateIndex -CREATE INDEX "_StatusToUser_B_index" ON "_StatusToUser"("B"); - --- CreateIndex -CREATE UNIQUE INDEX "_UserPinnedNotes_AB_unique" ON "_UserPinnedNotes"("A", "B"); - --- CreateIndex -CREATE INDEX "_UserPinnedNotes_B_index" ON "_UserPinnedNotes"("B"); - --- AddForeignKey -ALTER TABLE "Emoji" ADD CONSTRAINT "Emoji_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Like" ADD CONSTRAINT "Like_likerId_fkey" FOREIGN KEY ("likerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Like" ADD CONSTRAINT "Like_likedId_fkey" FOREIGN KEY ("likedId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "LysandObject" ADD CONSTRAINT "LysandObject_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "LysandObject"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Relationship" ADD CONSTRAINT "Relationship_ownerId_fkey" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Relationship" ADD CONSTRAINT "Relationship_subjectId_fkey" FOREIGN KEY ("subjectId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_reblogId_fkey" FOREIGN KEY ("reblogId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_inReplyToPostId_fkey" FOREIGN KEY ("inReplyToPostId") REFERENCES "Status"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_quotingPostId_fkey" FOREIGN KEY ("quotingPostId") REFERENCES "Status"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Status" ADD CONSTRAINT "Status_applicationId_fkey" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE SET NULL ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Token" ADD CONSTRAINT "Token_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Token" ADD CONSTRAINT "Token_applicationId_fkey" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "User" ADD CONSTRAINT "User_instanceId_fkey" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EmojiToUser" ADD CONSTRAINT "_EmojiToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Emoji"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EmojiToUser" ADD CONSTRAINT "_EmojiToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EmojiToStatus" ADD CONSTRAINT "_EmojiToStatus_A_fkey" FOREIGN KEY ("A") REFERENCES "Emoji"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_EmojiToStatus" ADD CONSTRAINT "_EmojiToStatus_B_fkey" FOREIGN KEY ("B") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_StatusToUser" ADD CONSTRAINT "_StatusToUser_A_fkey" FOREIGN KEY ("A") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_StatusToUser" ADD CONSTRAINT "_StatusToUser_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserPinnedNotes" ADD CONSTRAINT "_UserPinnedNotes_A_fkey" FOREIGN KEY ("A") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "_UserPinnedNotes" ADD CONSTRAINT "_UserPinnedNotes_B_fkey" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20231123022010_add_attachments/migration.sql b/prisma/migrations/20231123022010_add_attachments/migration.sql deleted file mode 100644 index 49152c59..00000000 --- a/prisma/migrations/20231123022010_add_attachments/migration.sql +++ /dev/null @@ -1,22 +0,0 @@ --- CreateTable -CREATE TABLE "Attachment" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "url" TEXT NOT NULL, - "remote_url" TEXT, - "thumbnail_url" TEXT, - "mime_type" TEXT NOT NULL, - "description" TEXT, - "blurhash" TEXT, - "sha256" TEXT, - "fps" INTEGER, - "duration" INTEGER, - "width" INTEGER, - "height" INTEGER, - "size" INTEGER, - "statusId" UUID, - - CONSTRAINT "Attachment_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Attachment" ADD CONSTRAINT "Attachment_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20231127010521_add_notifications/migration.sql b/prisma/migrations/20231127010521_add_notifications/migration.sql deleted file mode 100644 index 77d5b111..00000000 --- a/prisma/migrations/20231127010521_add_notifications/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ --- CreateTable -CREATE TABLE "Notification" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "type" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "notifiedId" UUID NOT NULL, - "accountId" UUID NOT NULL, - "statusId" UUID, - - CONSTRAINT "Notification_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "Notification" ADD CONSTRAINT "Notification_notifiedId_fkey" FOREIGN KEY ("notifiedId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Notification" ADD CONSTRAINT "Notification_accountId_fkey" FOREIGN KEY ("accountId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Notification" ADD CONSTRAINT "Notification_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20231202001242_add_source/migration.sql b/prisma/migrations/20231202001242_add_source/migration.sql deleted file mode 100644 index 272e2eb2..00000000 --- a/prisma/migrations/20231202001242_add_source/migration.sql +++ /dev/null @@ -1,2 +0,0 @@ --- AlterTable -ALTER TABLE "Status" ADD COLUMN "contentSource" TEXT NOT NULL DEFAULT ''; diff --git a/prisma/migrations/20231206215508_add_openid/migration.sql b/prisma/migrations/20231206215508_add_openid/migration.sql deleted file mode 100644 index 32b92f4d..00000000 --- a/prisma/migrations/20231206215508_add_openid/migration.sql +++ /dev/null @@ -1,20 +0,0 @@ --- CreateTable -CREATE TABLE "OpenIdLoginFlow" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "codeVerifier" TEXT NOT NULL, - - CONSTRAINT "OpenIdLoginFlow_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "OpenIdAccount" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "userId" UUID, - "serverId" TEXT NOT NULL, - "issuerId" TEXT NOT NULL, - - CONSTRAINT "OpenIdAccount_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "OpenIdAccount" ADD CONSTRAINT "OpenIdAccount_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/migrations/20231206231959_add_issuer_and_client_to_flows/migration.sql b/prisma/migrations/20231206231959_add_issuer_and_client_to_flows/migration.sql deleted file mode 100644 index 4e0ca8ae..00000000 --- a/prisma/migrations/20231206231959_add_issuer_and_client_to_flows/migration.sql +++ /dev/null @@ -1,12 +0,0 @@ -/* - Warnings: - - - Added the required column `issuerId` to the `OpenIdLoginFlow` table without a default value. This is not possible if the table is not empty. - -*/ --- AlterTable -ALTER TABLE "OpenIdLoginFlow" ADD COLUMN "applicationId" UUID, -ADD COLUMN "issuerId" TEXT NOT NULL; - --- AddForeignKey -ALTER TABLE "OpenIdLoginFlow" ADD CONSTRAINT "OpenIdLoginFlow_applicationId_fkey" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20231206232131_make_client_id_unique/migration.sql b/prisma/migrations/20231206232131_make_client_id_unique/migration.sql deleted file mode 100644 index 99632ccb..00000000 --- a/prisma/migrations/20231206232131_make_client_id_unique/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - A unique constraint covering the columns `[client_id]` on the table `Application` will be added. If there are existing duplicate values, this will fail. - -*/ --- CreateIndex -CREATE UNIQUE INDEX "Application_client_id_key" ON "Application"("client_id"); diff --git a/prisma/migrations/20240304012450_add_moderation_data/migration.sql b/prisma/migrations/20240304012450_add_moderation_data/migration.sql deleted file mode 100644 index 8b7a8fc1..00000000 --- a/prisma/migrations/20240304012450_add_moderation_data/migration.sql +++ /dev/null @@ -1,40 +0,0 @@ --- AlterTable -ALTER TABLE "Instance" ADD COLUMN "disableAutomoderation" BOOLEAN NOT NULL DEFAULT false; - --- AlterTable -ALTER TABLE "User" ADD COLUMN "disableAutomoderation" BOOLEAN NOT NULL DEFAULT false; - --- CreateTable -CREATE TABLE "ModerationData" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "statusId" UUID NOT NULL, - "creatorId" UUID NOT NULL, - "note" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" TIMESTAMP(3) NOT NULL, - - CONSTRAINT "ModerationData_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "Flag" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "statusId" UUID NOT NULL, - "userId" UUID NOT NULL, - "flagType" TEXT NOT NULL DEFAULT 'other', - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "Flag_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "ModerationData" ADD CONSTRAINT "ModerationData_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModerationData" ADD CONSTRAINT "ModerationData_creatorId_fkey" FOREIGN KEY ("creatorId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Flag" ADD CONSTRAINT "Flag_statusId_fkey" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Flag" ADD CONSTRAINT "Flag_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240304042832_rework_moderation/migration.sql b/prisma/migrations/20240304042832_rework_moderation/migration.sql deleted file mode 100644 index 460be492..00000000 --- a/prisma/migrations/20240304042832_rework_moderation/migration.sql +++ /dev/null @@ -1,76 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `statusId` on the `Flag` table. All the data in the column will be lost. - - You are about to drop the column `userId` on the `Flag` table. All the data in the column will be lost. - - You are about to drop the `ModerationData` table. If the table is not empty, all the data it contains will be lost. - -*/ --- DropForeignKey -ALTER TABLE "Flag" DROP CONSTRAINT "Flag_statusId_fkey"; - --- DropForeignKey -ALTER TABLE "Flag" DROP CONSTRAINT "Flag_userId_fkey"; - --- DropForeignKey -ALTER TABLE "ModerationData" DROP CONSTRAINT "ModerationData_creatorId_fkey"; - --- DropForeignKey -ALTER TABLE "ModerationData" DROP CONSTRAINT "ModerationData_statusId_fkey"; - --- AlterTable -ALTER TABLE "Flag" DROP COLUMN "statusId", -DROP COLUMN "userId", -ADD COLUMN "flaggeStatusId" UUID, -ADD COLUMN "flaggedUserId" UUID; - --- DropTable -DROP TABLE "ModerationData"; - --- CreateTable -CREATE TABLE "ModNote" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "notedStatusId" UUID, - "notedUserId" UUID, - "modId" UUID NOT NULL, - "note" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "ModNote_pkey" PRIMARY KEY ("id") -); - --- CreateTable -CREATE TABLE "ModTag" ( - "id" UUID NOT NULL DEFAULT uuid_generate_v7(), - "taggedStatusId" UUID, - "taggedUserId" UUID, - "modId" UUID NOT NULL, - "tag" TEXT NOT NULL, - "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, - - CONSTRAINT "ModTag_pkey" PRIMARY KEY ("id") -); - --- AddForeignKey -ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_notedStatusId_fkey" FOREIGN KEY ("notedStatusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_notedUserId_fkey" FOREIGN KEY ("notedUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_modId_fkey" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_taggedStatusId_fkey" FOREIGN KEY ("taggedStatusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_taggedUserId_fkey" FOREIGN KEY ("taggedUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_modId_fkey" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Flag" ADD CONSTRAINT "Flag_flaggeStatusId_fkey" FOREIGN KEY ("flaggeStatusId") REFERENCES "Status"("id") ON DELETE CASCADE ON UPDATE CASCADE; - --- AddForeignKey -ALTER TABLE "Flag" ADD CONSTRAINT "Flag_flaggedUserId_fkey" FOREIGN KEY ("flaggedUserId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/prisma/migrations/20240409042719_make_uri_nullable/migration.sql b/prisma/migrations/20240409042719_make_uri_nullable/migration.sql deleted file mode 100644 index 5b4b1d5e..00000000 --- a/prisma/migrations/20240409042719_make_uri_nullable/migration.sql +++ /dev/null @@ -1,5 +0,0 @@ --- AlterTable -ALTER TABLE "Status" ALTER COLUMN "uri" DROP NOT NULL; - --- AlterTable -ALTER TABLE "User" ALTER COLUMN "uri" DROP NOT NULL; diff --git a/prisma/migrations/20240410091400_drop_is_reblog/migration.sql b/prisma/migrations/20240410091400_drop_is_reblog/migration.sql deleted file mode 100644 index 05481d5f..00000000 --- a/prisma/migrations/20240410091400_drop_is_reblog/migration.sql +++ /dev/null @@ -1,8 +0,0 @@ -/* - Warnings: - - - You are about to drop the column `isReblog` on the `Status` table. All the data in the column will be lost. - -*/ --- AlterTable -ALTER TABLE "Status" DROP COLUMN "isReblog"; diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml deleted file mode 100644 index fbffa92c..00000000 --- a/prisma/migrations/migration_lock.toml +++ /dev/null @@ -1,3 +0,0 @@ -# Please do not edit this file manually -# It should be added in your version-control system (i.e. Git) -provider = "postgresql" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma deleted file mode 100644 index 214dd4b2..00000000 --- a/prisma/schema.prisma +++ /dev/null @@ -1,278 +0,0 @@ -generator client { - provider = "prisma-client-js" - previewFeatures = ["postgresqlExtensions"] - // These last two lines are important for Docker! - binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"] -} - -generator json { - provider = "prisma-json-types-generator" -} - -datasource db { - provider = "postgresql" - url = env("DATABASE_URL") - extensions = [pg_uuidv7] -} - -model Application { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - name String - website String? - vapid_key String? - client_id String @unique - secret String - scopes String - redirect_uris String - statuses Status[] // One to many relation with Status - tokens Token[] // One to many relation with Token - openIdLoginFlows OpenIdLoginFlow[] -} - -model Emoji { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - shortcode String - url String - visible_in_picker Boolean - instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade) - instanceId String? @db.Uuid - alt String? - content_type String - users User[] // Many to many relation with User - statuses Status[] // Many to many relation with Status -} - -model Instance { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - base_url String - name String - version String - /// [InstanceLogo] - logo Json - emojis Emoji[] // One to many relation with Emoji - statuses Status[] // One to many relation with Status - users User[] // One to many relation with User - disableAutomoderation Boolean @default(false) -} - -model Like { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - liker User @relation("UserLiked", fields: [likerId], references: [id], onDelete: Cascade) - likerId String @db.Uuid - liked Status @relation("LikedToStatus", fields: [likedId], references: [id], onDelete: Cascade) - likedId String @db.Uuid - createdAt DateTime @default(now()) -} - -model LysandObject { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - remote_id String @unique - type String - uri String @unique - created_at DateTime @default(now()) - author LysandObject? @relation("LysandObjectToAuthor", fields: [authorId], references: [id], onDelete: Cascade) - authorId String? @db.Uuid - /// [ObjectData] - extra_data Json - /// [ObjectExtensions] - extensions Json - children LysandObject[] @relation("LysandObjectToAuthor") -} - -model Relationship { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - owner User @relation("OwnerToRelationship", fields: [ownerId], references: [id], onDelete: Cascade) - ownerId String @db.Uuid - subject User @relation("SubjectToRelationship", fields: [subjectId], references: [id], onDelete: Cascade) - subjectId String @db.Uuid - following Boolean - showingReblogs Boolean - notifying Boolean - followedBy Boolean - blocking Boolean - blockedBy Boolean - muting Boolean - mutingNotifications Boolean - requested Boolean - domainBlocking Boolean - endorsed Boolean - languages String[] - note String - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt -} - -model Status { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - uri String? @unique - author User @relation("UserStatuses", fields: [authorId], references: [id], onDelete: Cascade) - authorId String @db.Uuid - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - reblog Status? @relation("StatusToStatus", fields: [reblogId], references: [id], onDelete: Cascade) - reblogId String? @db.Uuid - content String @default("") - contentType String @default("text/plain") - contentSource String @default("") - visibility String - inReplyToPost Status? @relation("StatusToStatusReply", fields: [inReplyToPostId], references: [id], onDelete: SetNull) - inReplyToPostId String? @db.Uuid - quotingPost Status? @relation("StatusToStatusQuote", fields: [quotingPostId], references: [id], onDelete: SetNull) - quotingPostId String? @db.Uuid - instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade) - instanceId String? @db.Uuid - sensitive Boolean - spoilerText String @default("") - application Application? @relation(fields: [applicationId], references: [id], onDelete: SetNull) - applicationId String? @db.Uuid - emojis Emoji[] @relation - mentions User[] - likes Like[] @relation("LikedToStatus") - reblogs Status[] @relation("StatusToStatus") - replies Status[] @relation("StatusToStatusReply") - quotes Status[] @relation("StatusToStatusQuote") - pinnedBy User[] @relation("UserPinnedNotes") - attachments Attachment[] - relatedNotifications Notification[] - flags Flag[] - modNotes ModNote[] - modTags ModTag[] -} - -model ModNote { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - notedStatus Status? @relation(fields: [notedStatusId], references: [id], onDelete: Cascade) - notedStatusId String? @db.Uuid - notedUser User? @relation("ModNoteToUser", fields: [notedUserId], references: [id], onDelete: Cascade) - notedUserId String? @db.Uuid - mod User @relation("ModNoteToMod", fields: [modId], references: [id], onDelete: Cascade) - modId String @db.Uuid - note String - createdAt DateTime @default(now()) -} - -model ModTag { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - taggedStatus Status? @relation(fields: [taggedStatusId], references: [id], onDelete: Cascade) - taggedStatusId String? @db.Uuid - taggedUser User? @relation("ModNoteToTaggedUser", fields: [taggedUserId], references: [id], onDelete: Cascade) - taggedUserId String? @db.Uuid - mod User @relation("ModTagToMod", fields: [modId], references: [id], onDelete: Cascade) - modId String @db.Uuid - tag String - createdAt DateTime @default(now()) -} - -// Used to tag notes and accounts with automatic moderation infractions -model Flag { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - flaggedStatus Status? @relation(fields: [flaggeStatusId], references: [id], onDelete: Cascade) - flaggeStatusId String? @db.Uuid - flaggedUser User? @relation(fields: [flaggedUserId], references: [id], onDelete: Cascade) - flaggedUserId String? @db.Uuid - flagType String @default("other") - createdAt DateTime @default(now()) -} - -model Token { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - token_type String - scope String - access_token String - code String - created_at DateTime @default(now()) - user User? @relation(fields: [userId], references: [id], onDelete: Cascade) - userId String? @db.Uuid - application Application? @relation(fields: [applicationId], references: [id], onDelete: Cascade) - applicationId String? @db.Uuid -} - -model OpenIdLoginFlow { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - codeVerifier String - issuerId String - application Application? @relation(fields: [applicationId], references: [id], onDelete: Cascade) - applicationId String? @db.Uuid -} - -model Attachment { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - url String - remote_url String? - thumbnail_url String? - mime_type String - description String? - blurhash String? - sha256 String? - fps Int? - duration Int? - width Int? - height Int? - size Int? - status Status? @relation(fields: [statusId], references: [id], onDelete: Cascade) - statusId String? @db.Uuid -} - -model Notification { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - type String - createdAt DateTime @default(now()) - notified User @relation("NotificationToNotified", fields: [notifiedId], references: [id], onDelete: Cascade) - notifiedId String @db.Uuid - account User @relation(fields: [accountId], references: [id], onDelete: Cascade) - accountId String @db.Uuid - status Status? @relation(fields: [statusId], references: [id], onDelete: Cascade) - statusId String? @db.Uuid -} - -model User { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - uri String? @unique - username String @unique - displayName String - password String? // Nullable - email String? @unique // Nullable - note String @default("") - isAdmin Boolean @default(false) - /// [UserEndpoints] - endpoints Json? // Nullable - /// [UserSource] - source Json - avatar String - header String - createdAt DateTime @default(now()) - updatedAt DateTime @updatedAt - isBot Boolean @default(false) - isLocked Boolean @default(false) - isDiscoverable Boolean @default(false) - sanctions String[] @default([]) - publicKey String - privateKey String? // Nullable - relationships Relationship[] @relation("OwnerToRelationship") // One to many relation with Relationship - relationshipSubjects Relationship[] @relation("SubjectToRelationship") // One to many relation with Relationship - instance Instance? @relation(fields: [instanceId], references: [id], onDelete: Cascade) // Many to one relation with Instance - instanceId String? @db.Uuid - pinnedNotes Status[] @relation("UserPinnedNotes") // Many to many relation with Status - emojis Emoji[] // Many to many relation with Emoji - statuses Status[] @relation("UserStatuses") // One to many relation with Status - tokens Token[] // One to many relation with Token - likes Like[] @relation("UserLiked") // One to many relation with Like - statusesMentioned Status[] // Many to many relation with Status - notifications Notification[] // One to many relation with Notification - notified Notification[] @relation("NotificationToNotified") // One to many relation with Notification - linkedOpenIdAccounts OpenIdAccount[] // One to many relation with OpenIdAccount - flags Flag[] - modNotes ModNote[] @relation("ModNoteToUser") - modTags ModTag[] @relation("ModNoteToTaggedUser") - disableAutomoderation Boolean @default(false) - createdModTags ModTag[] @relation("ModTagToMod") - createdModNotes ModNote[] @relation("ModNoteToMod") -} - -model OpenIdAccount { - id String @id @default(dbgenerated("uuid_generate_v7()")) @db.Uuid - User User? @relation(fields: [userId], references: [id]) - userId String? @db.Uuid - serverId String // ID on the authorization server - issuerId String -}