diff --git a/database/entities/Status.ts b/database/entities/Status.ts index 58329680..57c16f23 100644 --- a/database/entities/Status.ts +++ b/database/entities/Status.ts @@ -23,7 +23,7 @@ import { instance, type like, status, - statusToUser, + statusToMentions, user, } from "~drizzle/schema"; import type { APIAttachment } from "~types/entities/attachment"; @@ -946,8 +946,8 @@ export const createNewStatus = async ( await db .insert(emojiToStatus) .values({ - a: emoji.id, - b: newStatus.id, + emojiId: emoji.id, + statusId: newStatus.id, }) .execute(); } @@ -955,10 +955,10 @@ export const createNewStatus = async ( // Connect mentions for (const mention of mentions ?? []) { await db - .insert(statusToUser) + .insert(statusToMentions) .values({ - a: newStatus.id, - b: mention.id, + statusId: newStatus.id, + userId: mention.id, }) .execute(); } @@ -1109,8 +1109,8 @@ export const editStatus = async ( await db .insert(emojiToStatus) .values({ - a: emoji.id, - b: updated.id, + emojiId: emoji.id, + statusId: updated.id, }) .execute(); } @@ -1118,10 +1118,10 @@ export const editStatus = async ( // Connect mentions for (const mention of mentions) { await db - .insert(statusToUser) + .insert(statusToMentions) .values({ - a: updated.id, - b: mention.id, + statusId: updated.id, + userId: mention.id, }) .execute(); } @@ -1157,11 +1157,11 @@ export const statusToAPI = async ( userFetching?: UserWithRelations, ): Promise => { const wasPinnedByUser = userFetching - ? !!(await db.query.statusToUser.findFirst({ + ? !!(await db.query.userPinnedNotes.findFirst({ where: (relation, { and, eq }) => and( - eq(relation.a, statusToConvert.id), - eq(relation.b, userFetching?.id), + eq(relation.statusId, statusToConvert.id), + eq(relation.userId, userFetching?.id), ), })) : false; diff --git a/database/entities/User.ts b/database/entities/User.ts index 065e8471..8562b0db 100644 --- a/database/entities/User.ts +++ b/database/entities/User.ts @@ -108,14 +108,14 @@ export const userExtrasTemplate = (name: string) => ({ instance: true, emojis: { with: { - instance: true, + emoji: { + with: { + instance: true, + }, + }, }, }, }, - extras: { - // - followerCount: sql`SELECT COUNT(*) FROM relationship WHERE owner_id = user.id AND following = true`, - }, }); */ export interface AuthData { @@ -262,8 +262,8 @@ export const transformOutputToUserWithRelations = ( followingCount: unknown; statusCount: unknown; emojis: { - a: string; - b: string; + userId: string; + emojiId: string; emoji?: EmojiWithInstance; }[]; instance: InferSelectModel | null; @@ -447,8 +447,8 @@ export const resolveUser = async ( if (emojis.length > 0) { await db.insert(emojiToUser).values( emojis.map((emoji) => ({ - a: emoji.id, - b: newUser.id, + emojiId: emoji.id, + userId: newUser.id, })), ); } diff --git a/drizzle.config.ts b/drizzle.config.ts index 2deb46bb..cee649d5 100644 --- a/drizzle.config.ts +++ b/drizzle.config.ts @@ -1,4 +1,4 @@ -import { config } from "config-manager"; +// import { config } from "config-manager"; import type { Config } from "drizzle-kit"; export default { @@ -6,12 +6,19 @@ export default { out: "./drizzle", schema: "./drizzle/schema.ts", dbCredentials: { + host: "localhost", + port: 40003, + user: "lysand", + password: "lysand", + database: "lysand", + }, + /* dbCredentials: { host: config.database.host, port: Number(config.database.port), user: config.database.username, password: config.database.password, database: config.database.database, - }, + }, */ // Print all statements verbose: true, // Always ask for confirmation diff --git a/drizzle/0000_illegal_living_lightning.sql b/drizzle/0000_illegal_living_lightning.sql index 98c2e90e..73d62bb5 100644 --- a/drizzle/0000_illegal_living_lightning.sql +++ b/drizzle/0000_illegal_living_lightning.sql @@ -1,6 +1,5 @@ -- Current sql file was generated after introspecting the database -- If you want to run this migration please uncomment this code before executing migrations -/* CREATE TABLE IF NOT EXISTS "_prisma_migrations" ( "id" varchar(36) PRIMARY KEY NOT NULL, "checksum" varchar(64) NOT NULL, @@ -457,6 +456,4 @@ DO $$ BEGIN ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_modId_fkey" FOREIGN KEY ("modId") REFERENCES "public"."User"("id") ON DELETE cascade ON UPDATE cascade; EXCEPTION WHEN duplicate_object THEN null; -END $$; - -*/ \ No newline at end of file +END $$; \ No newline at end of file diff --git a/drizzle/0001_salty_night_thrasher.sql b/drizzle/0001_salty_night_thrasher.sql new file mode 100644 index 00000000..c31ac1c5 --- /dev/null +++ b/drizzle/0001_salty_night_thrasher.sql @@ -0,0 +1,292 @@ +DROP TABLE "_prisma_migrations";--> statement-breakpoint +ALTER TABLE "Emoji" DROP CONSTRAINT "Emoji_instanceId_fkey"; +--> statement-breakpoint +ALTER TABLE "Like" DROP CONSTRAINT "Like_likerId_fkey"; +--> statement-breakpoint +ALTER TABLE "Like" DROP CONSTRAINT "Like_likedId_fkey"; +--> statement-breakpoint +ALTER TABLE "LysandObject" DROP CONSTRAINT "LysandObject_authorId_fkey"; +--> statement-breakpoint +ALTER TABLE "Relationship" DROP CONSTRAINT "Relationship_ownerId_fkey"; +--> statement-breakpoint +ALTER TABLE "Relationship" DROP CONSTRAINT "Relationship_subjectId_fkey"; +--> statement-breakpoint +ALTER TABLE "Token" DROP CONSTRAINT "Token_userId_fkey"; +--> statement-breakpoint +ALTER TABLE "Token" DROP CONSTRAINT "Token_applicationId_fkey"; +--> statement-breakpoint +ALTER TABLE "_EmojiToUser" DROP CONSTRAINT "_EmojiToUser_A_fkey"; +--> statement-breakpoint +ALTER TABLE "_EmojiToUser" DROP CONSTRAINT "_EmojiToUser_B_fkey"; +--> statement-breakpoint +ALTER TABLE "_EmojiToStatus" DROP CONSTRAINT "_EmojiToStatus_A_fkey"; +--> statement-breakpoint +ALTER TABLE "_EmojiToStatus" DROP CONSTRAINT "_EmojiToStatus_B_fkey"; +--> statement-breakpoint +ALTER TABLE "_StatusToUser" DROP CONSTRAINT "_StatusToUser_A_fkey"; +--> statement-breakpoint +ALTER TABLE "_StatusToUser" DROP CONSTRAINT "_StatusToUser_B_fkey"; +--> statement-breakpoint +ALTER TABLE "_UserPinnedNotes" DROP CONSTRAINT "_UserPinnedNotes_A_fkey"; +--> statement-breakpoint +ALTER TABLE "_UserPinnedNotes" DROP CONSTRAINT "_UserPinnedNotes_B_fkey"; +--> statement-breakpoint +ALTER TABLE "Attachment" DROP CONSTRAINT "Attachment_statusId_fkey"; +--> statement-breakpoint +ALTER TABLE "Notification" DROP CONSTRAINT "Notification_notifiedId_fkey"; +--> statement-breakpoint +ALTER TABLE "Notification" DROP CONSTRAINT "Notification_accountId_fkey"; +--> statement-breakpoint +ALTER TABLE "Notification" DROP CONSTRAINT "Notification_statusId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_authorId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_instanceId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_applicationId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_reblogId_fkey"; +--> statement-breakpoint +ALTER TABLE "OpenIdAccount" DROP CONSTRAINT "OpenIdAccount_userId_fkey"; +--> statement-breakpoint +ALTER TABLE "User" DROP CONSTRAINT "User_instanceId_fkey"; +--> statement-breakpoint +ALTER TABLE "OpenIdLoginFlow" DROP CONSTRAINT "OpenIdLoginFlow_applicationId_fkey"; +--> statement-breakpoint +ALTER TABLE "Flag" DROP CONSTRAINT "Flag_flaggeStatusId_fkey"; +--> statement-breakpoint +ALTER TABLE "Flag" DROP CONSTRAINT "Flag_flaggedUserId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModNote" DROP CONSTRAINT "ModNote_notedStatusId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModNote" DROP CONSTRAINT "ModNote_notedUserId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModNote" DROP CONSTRAINT "ModNote_modId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModTag" DROP CONSTRAINT "ModTag_taggedStatusId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModTag" DROP CONSTRAINT "ModTag_taggedUserId_fkey"; +--> statement-breakpoint +ALTER TABLE "ModTag" DROP CONSTRAINT "ModTag_modId_fkey"; +--> statement-breakpoint +ALTER TABLE "Like" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "LysandObject" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "Relationship" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "Token" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "Notification" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "Status" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "User" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "User" ALTER COLUMN "updatedAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "User" ALTER COLUMN "sanctions" DROP DEFAULT;--> statement-breakpoint +ALTER TABLE "Flag" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "ModNote" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "ModTag" ALTER COLUMN "createdAt" SET DEFAULT now();--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Emoji" ADD CONSTRAINT "Emoji_instanceId_Instance_id_fk" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Like" ADD CONSTRAINT "Like_likerId_User_id_fk" FOREIGN KEY ("likerId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Like" ADD CONSTRAINT "Like_likedId_Status_id_fk" FOREIGN KEY ("likedId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "LysandObject" ADD CONSTRAINT "LysandObject_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "LysandObject"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Relationship" ADD CONSTRAINT "Relationship_ownerId_User_id_fk" FOREIGN KEY ("ownerId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Relationship" ADD CONSTRAINT "Relationship_subjectId_User_id_fk" FOREIGN KEY ("subjectId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Token" ADD CONSTRAINT "Token_userId_User_id_fk" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Token" ADD CONSTRAINT "Token_applicationId_Application_id_fk" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_EmojiToUser" ADD CONSTRAINT "_EmojiToUser_A_Emoji_id_fk" FOREIGN KEY ("A") REFERENCES "Emoji"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_EmojiToUser" ADD CONSTRAINT "_EmojiToUser_B_User_id_fk" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_EmojiToStatus" ADD CONSTRAINT "_EmojiToStatus_A_Emoji_id_fk" FOREIGN KEY ("A") REFERENCES "Emoji"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_EmojiToStatus" ADD CONSTRAINT "_EmojiToStatus_B_Status_id_fk" FOREIGN KEY ("B") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_StatusToUser" ADD CONSTRAINT "_StatusToUser_A_Status_id_fk" FOREIGN KEY ("A") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_StatusToUser" ADD CONSTRAINT "_StatusToUser_B_User_id_fk" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_UserPinnedNotes" ADD CONSTRAINT "_UserPinnedNotes_A_Status_id_fk" FOREIGN KEY ("A") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "_UserPinnedNotes" ADD CONSTRAINT "_UserPinnedNotes_B_User_id_fk" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Attachment" ADD CONSTRAINT "Attachment_statusId_Status_id_fk" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Notification" ADD CONSTRAINT "Notification_notifiedId_User_id_fk" FOREIGN KEY ("notifiedId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Notification" ADD CONSTRAINT "Notification_accountId_User_id_fk" FOREIGN KEY ("accountId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Notification" ADD CONSTRAINT "Notification_statusId_Status_id_fk" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_authorId_User_id_fk" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_instanceId_Instance_id_fk" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_applicationId_Application_id_fk" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE set null ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_reblogId_fkey" FOREIGN KEY ("reblogId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "OpenIdAccount" ADD CONSTRAINT "OpenIdAccount_userId_User_id_fk" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE set null ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "User" ADD CONSTRAINT "User_instanceId_Instance_id_fk" FOREIGN KEY ("instanceId") REFERENCES "Instance"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "OpenIdLoginFlow" ADD CONSTRAINT "OpenIdLoginFlow_applicationId_Application_id_fk" FOREIGN KEY ("applicationId") REFERENCES "Application"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Flag" ADD CONSTRAINT "Flag_flaggeStatusId_Status_id_fk" FOREIGN KEY ("flaggeStatusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Flag" ADD CONSTRAINT "Flag_flaggedUserId_User_id_fk" FOREIGN KEY ("flaggedUserId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_notedStatusId_Status_id_fk" FOREIGN KEY ("notedStatusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_notedUserId_User_id_fk" FOREIGN KEY ("notedUserId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModNote" ADD CONSTRAINT "ModNote_modId_User_id_fk" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_taggedStatusId_Status_id_fk" FOREIGN KEY ("taggedStatusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_taggedUserId_User_id_fk" FOREIGN KEY ("taggedUserId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "ModTag" ADD CONSTRAINT "ModTag_modId_User_id_fk" FOREIGN KEY ("modId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/0002_stiff_ares.sql b/drizzle/0002_stiff_ares.sql new file mode 100644 index 00000000..fda688b3 --- /dev/null +++ b/drizzle/0002_stiff_ares.sql @@ -0,0 +1,20 @@ +ALTER TABLE "_StatusToUser" RENAME TO "StatusToMentions";--> statement-breakpoint +ALTER TABLE "StatusToMentions" DROP CONSTRAINT "_StatusToUser_A_Status_id_fk"; +--> statement-breakpoint +ALTER TABLE "StatusToMentions" DROP CONSTRAINT "_StatusToUser_B_User_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "_StatusToUser_AB_unique";--> statement-breakpoint +DROP INDEX IF EXISTS "_StatusToUser_B_index";--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "StatusToMentions_A_B_index" ON "StatusToMentions" ("A","B");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "StatusToMentions_B_index" ON "StatusToMentions" ("B");--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "StatusToMentions" ADD CONSTRAINT "StatusToMentions_A_Status_id_fk" FOREIGN KEY ("A") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "StatusToMentions" ADD CONSTRAINT "StatusToMentions_B_User_id_fk" FOREIGN KEY ("B") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/0003_spicy_arachne.sql b/drizzle/0003_spicy_arachne.sql new file mode 100644 index 00000000..af8ad7a4 --- /dev/null +++ b/drizzle/0003_spicy_arachne.sql @@ -0,0 +1,21 @@ +ALTER TABLE "StatusToMentions" RENAME COLUMN "A" TO "statusId";--> statement-breakpoint +ALTER TABLE "StatusToMentions" RENAME COLUMN "B" TO "userId";--> statement-breakpoint +ALTER TABLE "StatusToMentions" DROP CONSTRAINT "StatusToMentions_A_Status_id_fk"; +--> statement-breakpoint +ALTER TABLE "StatusToMentions" DROP CONSTRAINT "StatusToMentions_B_User_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "StatusToMentions_A_B_index";--> statement-breakpoint +DROP INDEX IF EXISTS "StatusToMentions_B_index";--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "StatusToMentions_statusId_userId_index" ON "StatusToMentions" ("statusId","userId");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "StatusToMentions_userId_index" ON "StatusToMentions" ("userId");--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "StatusToMentions" ADD CONSTRAINT "StatusToMentions_statusId_Status_id_fk" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "StatusToMentions" ADD CONSTRAINT "StatusToMentions_userId_User_id_fk" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/0004_burly_lockjaw.sql b/drizzle/0004_burly_lockjaw.sql new file mode 100644 index 00000000..52974249 --- /dev/null +++ b/drizzle/0004_burly_lockjaw.sql @@ -0,0 +1,57 @@ +ALTER TABLE "_EmojiToStatus" RENAME TO "EmojiToStatus";--> statement-breakpoint +ALTER TABLE "_UserPinnedNotes" RENAME TO "UserToPinnedNotes";--> statement-breakpoint +ALTER TABLE "EmojiToStatus" RENAME COLUMN "A" TO "emojiId";--> statement-breakpoint +ALTER TABLE "EmojiToStatus" RENAME COLUMN "B" TO "statusId";--> statement-breakpoint +ALTER TABLE "UserToPinnedNotes" RENAME COLUMN "A" TO "userId";--> statement-breakpoint +ALTER TABLE "UserToPinnedNotes" RENAME COLUMN "B" TO "statusId";--> statement-breakpoint +ALTER TABLE "LysandObject" DROP CONSTRAINT "LysandObject_authorId_fkey"; +--> statement-breakpoint +ALTER TABLE "EmojiToStatus" DROP CONSTRAINT "_EmojiToStatus_A_Emoji_id_fk"; +--> statement-breakpoint +ALTER TABLE "EmojiToStatus" DROP CONSTRAINT "_EmojiToStatus_B_Status_id_fk"; +--> statement-breakpoint +ALTER TABLE "UserToPinnedNotes" DROP CONSTRAINT "_UserPinnedNotes_A_Status_id_fk"; +--> statement-breakpoint +ALTER TABLE "UserToPinnedNotes" DROP CONSTRAINT "_UserPinnedNotes_B_User_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "LysandObject_remote_id_key";--> statement-breakpoint +DROP INDEX IF EXISTS "LysandObject_uri_key";--> statement-breakpoint +DROP INDEX IF EXISTS "_EmojiToStatus_AB_unique";--> statement-breakpoint +DROP INDEX IF EXISTS "_EmojiToStatus_B_index";--> statement-breakpoint +DROP INDEX IF EXISTS "_UserPinnedNotes_AB_unique";--> statement-breakpoint +DROP INDEX IF EXISTS "_UserPinnedNotes_B_index";--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "LysandObject_remote_id_index" ON "LysandObject" ("remote_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "LysandObject_uri_index" ON "LysandObject" ("uri");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "EmojiToStatus_emojiId_statusId_index" ON "EmojiToStatus" ("emojiId","statusId");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "EmojiToStatus_statusId_index" ON "EmojiToStatus" ("statusId");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "UserToPinnedNotes_userId_statusId_index" ON "UserToPinnedNotes" ("userId","statusId");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "UserToPinnedNotes_statusId_index" ON "UserToPinnedNotes" ("statusId");--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "LysandObject" ADD CONSTRAINT "LysandObject_authorId_LysandObject_id_fk" FOREIGN KEY ("authorId") REFERENCES "LysandObject"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "EmojiToStatus" ADD CONSTRAINT "EmojiToStatus_emojiId_Emoji_id_fk" FOREIGN KEY ("emojiId") REFERENCES "Emoji"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "EmojiToStatus" ADD CONSTRAINT "EmojiToStatus_statusId_Status_id_fk" FOREIGN KEY ("statusId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "UserToPinnedNotes" ADD CONSTRAINT "UserToPinnedNotes_userId_Status_id_fk" FOREIGN KEY ("userId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "UserToPinnedNotes" ADD CONSTRAINT "UserToPinnedNotes_statusId_User_id_fk" FOREIGN KEY ("statusId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/0005_sleepy_puma.sql b/drizzle/0005_sleepy_puma.sql new file mode 100644 index 00000000..f29f7b93 --- /dev/null +++ b/drizzle/0005_sleepy_puma.sql @@ -0,0 +1,40 @@ +ALTER TABLE "Instance" RENAME COLUMN "disableAutomoderation" TO "disable_automoderation";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "showingReblogs" TO "showing_reblogs";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "followedBy" TO "followed_by";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "blockedBy" TO "blocked_by";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "mutingNotifications" TO "muting_notifications";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "domainBlocking" TO "domain_blocking";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "createdAt" TO "created_at";--> statement-breakpoint +ALTER TABLE "Relationship" RENAME COLUMN "updatedAt" TO "updated_at";--> statement-breakpoint +ALTER TABLE "Status" RENAME COLUMN "contentType" TO "content_type";--> statement-breakpoint +ALTER TABLE "Status" RENAME COLUMN "spoilerText" TO "spoiler_text";--> statement-breakpoint +ALTER TABLE "Status" RENAME COLUMN "contentSource" TO "content_source";--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_reblogId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_inReplyToPostId_fkey"; +--> statement-breakpoint +ALTER TABLE "Status" DROP CONSTRAINT "Status_quotingPostId_fkey"; +--> statement-breakpoint +DROP INDEX IF EXISTS "Application_client_id_key";--> statement-breakpoint +DROP INDEX IF EXISTS "Status_uri_key";--> statement-breakpoint +ALTER TABLE "Relationship" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint +ALTER TABLE "Status" ALTER COLUMN "updatedAt" SET DEFAULT now();--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "Application_client_id_index" ON "Application" ("client_id");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "Status_uri_index" ON "Status" ("uri");--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_reblogId_Status_id_fk" FOREIGN KEY ("reblogId") REFERENCES "Status"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_inReplyToPostId_Status_id_fk" FOREIGN KEY ("inReplyToPostId") REFERENCES "Status"("id") ON DELETE set null ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "Status" ADD CONSTRAINT "Status_quotingPostId_Status_id_fk" FOREIGN KEY ("quotingPostId") REFERENCES "Status"("id") ON DELETE set null ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/0006_messy_network.sql b/drizzle/0006_messy_network.sql new file mode 100644 index 00000000..e72193ce --- /dev/null +++ b/drizzle/0006_messy_network.sql @@ -0,0 +1,46 @@ +ALTER TABLE "_EmojiToUser" RENAME TO "EmojiToUser";--> statement-breakpoint +ALTER TABLE "Flag" RENAME COLUMN "flagType" TO "flag_type";--> statement-breakpoint +ALTER TABLE "Flag" RENAME COLUMN "createdAt" TO "created_at";--> statement-breakpoint +ALTER TABLE "ModNote" RENAME COLUMN "createdAt" TO "created_at";--> statement-breakpoint +ALTER TABLE "ModTag" RENAME COLUMN "createdAt" TO "created_at";--> statement-breakpoint +ALTER TABLE "OpenIdAccount" RENAME COLUMN "serverId" TO "server_id";--> statement-breakpoint +ALTER TABLE "OpenIdAccount" RENAME COLUMN "issuerId" TO "issuer_id";--> statement-breakpoint +ALTER TABLE "OpenIdLoginFlow" RENAME COLUMN "codeVerifier" TO "code_verifier";--> statement-breakpoint +ALTER TABLE "OpenIdLoginFlow" RENAME COLUMN "issuerId" TO "issuer_id";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "displayName" TO "display_name";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "isAdmin" TO "is_admin";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "createdAt" TO "created_at";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "updatedAt" TO "updated_at";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "isBot" TO "is_bot";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "isLocked" TO "is_locked";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "isDiscoverable" TO "is_discoverable";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "publicKey" TO "public_key";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "privateKey" TO "private_key";--> statement-breakpoint +ALTER TABLE "User" RENAME COLUMN "disableAutomoderation" TO "disable_automoderation";--> statement-breakpoint +ALTER TABLE "EmojiToUser" RENAME COLUMN "A" TO "emojiId";--> statement-breakpoint +ALTER TABLE "EmojiToUser" RENAME COLUMN "B" TO "userId";--> statement-breakpoint +ALTER TABLE "EmojiToUser" DROP CONSTRAINT "_EmojiToUser_A_Emoji_id_fk"; +--> statement-breakpoint +ALTER TABLE "EmojiToUser" DROP CONSTRAINT "_EmojiToUser_B_User_id_fk"; +--> statement-breakpoint +DROP INDEX IF EXISTS "User_uri_key";--> statement-breakpoint +DROP INDEX IF EXISTS "User_username_key";--> statement-breakpoint +DROP INDEX IF EXISTS "User_email_key";--> statement-breakpoint +DROP INDEX IF EXISTS "_EmojiToUser_AB_unique";--> statement-breakpoint +DROP INDEX IF EXISTS "_EmojiToUser_B_index";--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "User_uri_index" ON "User" ("uri");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "User_username_index" ON "User" ("username");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "User_email_index" ON "User" ("email");--> statement-breakpoint +CREATE UNIQUE INDEX IF NOT EXISTS "EmojiToUser_emojiId_userId_index" ON "EmojiToUser" ("emojiId","userId");--> statement-breakpoint +CREATE INDEX IF NOT EXISTS "EmojiToUser_userId_index" ON "EmojiToUser" ("userId");--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "EmojiToUser" ADD CONSTRAINT "EmojiToUser_emojiId_Emoji_id_fk" FOREIGN KEY ("emojiId") REFERENCES "Emoji"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; +--> statement-breakpoint +DO $$ BEGIN + ALTER TABLE "EmojiToUser" ADD CONSTRAINT "EmojiToUser_userId_User_id_fk" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE cascade ON UPDATE cascade; +EXCEPTION + WHEN duplicate_object THEN null; +END $$; diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json new file mode 100644 index 00000000..398b4d23 --- /dev/null +++ b/drizzle/meta/0001_snapshot.json @@ -0,0 +1,1588 @@ +{ + "id": "ad54a602-655a-4e6c-8162-70fdbeaa1535", + "prevId": "00000000-0000-0000-0000-000000000000", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_key": { + "name": "Application_client_id_key", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToStatus": { + "name": "_EmojiToStatus", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToStatus_AB_unique": { + "name": "_EmojiToStatus_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToStatus_B_index": { + "name": "_EmojiToStatus_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToStatus_A_Emoji_id_fk": { + "name": "_EmojiToStatus_A_Emoji_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToStatus_B_Status_id_fk": { + "name": "_EmojiToStatus_B_Status_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToUser": { + "name": "_EmojiToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToUser_AB_unique": { + "name": "_EmojiToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToUser_B_index": { + "name": "_EmojiToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToUser_A_Emoji_id_fk": { + "name": "_EmojiToUser_A_Emoji_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToUser_B_User_id_fk": { + "name": "_EmojiToUser_B_User_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flagType": { + "name": "flagType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_key": { + "name": "LysandObject_remote_id_key", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_key": { + "name": "LysandObject_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_fkey": { + "name": "LysandObject_authorId_fkey", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serverId": { + "name": "serverId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "codeVerifier": { + "name": "codeVerifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showingReblogs": { + "name": "showingReblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followedBy": { + "name": "followedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blockedBy": { + "name": "blockedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "mutingNotifications": { + "name": "mutingNotifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domainBlocking": { + "name": "domainBlocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "contentType": { + "name": "contentType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoilerText": { + "name": "spoilerText", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contentSource": { + "name": "contentSource", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_key": { + "name": "Status_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_fkey": { + "name": "Status_reblogId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_fkey": { + "name": "Status_inReplyToPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_fkey": { + "name": "Status_quotingPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_StatusToUser": { + "name": "_StatusToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_StatusToUser_AB_unique": { + "name": "_StatusToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_StatusToUser_B_index": { + "name": "_StatusToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_StatusToUser_A_Status_id_fk": { + "name": "_StatusToUser_A_Status_id_fk", + "tableFrom": "_StatusToUser", + "tableTo": "Status", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_StatusToUser_B_User_id_fk": { + "name": "_StatusToUser_B_User_id_fk", + "tableFrom": "_StatusToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "isAdmin": { + "name": "isAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "isBot": { + "name": "isBot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isLocked": { + "name": "isLocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isDiscoverable": { + "name": "isDiscoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_key": { + "name": "User_uri_key", + "columns": ["uri"], + "isUnique": true + }, + "User_username_key": { + "name": "User_username_key", + "columns": ["username"], + "isUnique": true + }, + "User_email_key": { + "name": "User_email_key", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_UserPinnedNotes": { + "name": "_UserPinnedNotes", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_UserPinnedNotes_AB_unique": { + "name": "_UserPinnedNotes_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_UserPinnedNotes_B_index": { + "name": "_UserPinnedNotes_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_UserPinnedNotes_A_Status_id_fk": { + "name": "_UserPinnedNotes_A_Status_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_UserPinnedNotes_B_User_id_fk": { + "name": "_UserPinnedNotes_B_User_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/0002_snapshot.json b/drizzle/meta/0002_snapshot.json new file mode 100644 index 00000000..13ab196e --- /dev/null +++ b/drizzle/meta/0002_snapshot.json @@ -0,0 +1,1588 @@ +{ + "id": "da4a79a8-2655-4733-9886-77a286037ae6", + "prevId": "ad54a602-655a-4e6c-8162-70fdbeaa1535", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_key": { + "name": "Application_client_id_key", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToStatus": { + "name": "_EmojiToStatus", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToStatus_AB_unique": { + "name": "_EmojiToStatus_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToStatus_B_index": { + "name": "_EmojiToStatus_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToStatus_A_Emoji_id_fk": { + "name": "_EmojiToStatus_A_Emoji_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToStatus_B_Status_id_fk": { + "name": "_EmojiToStatus_B_Status_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToUser": { + "name": "_EmojiToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToUser_AB_unique": { + "name": "_EmojiToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToUser_B_index": { + "name": "_EmojiToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToUser_A_Emoji_id_fk": { + "name": "_EmojiToUser_A_Emoji_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToUser_B_User_id_fk": { + "name": "_EmojiToUser_B_User_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flagType": { + "name": "flagType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_key": { + "name": "LysandObject_remote_id_key", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_key": { + "name": "LysandObject_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_fkey": { + "name": "LysandObject_authorId_fkey", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serverId": { + "name": "serverId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "codeVerifier": { + "name": "codeVerifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showingReblogs": { + "name": "showingReblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followedBy": { + "name": "followedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blockedBy": { + "name": "blockedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "mutingNotifications": { + "name": "mutingNotifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domainBlocking": { + "name": "domainBlocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "contentType": { + "name": "contentType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoilerText": { + "name": "spoilerText", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contentSource": { + "name": "contentSource", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_key": { + "name": "Status_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_fkey": { + "name": "Status_reblogId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_fkey": { + "name": "Status_inReplyToPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_fkey": { + "name": "Status_quotingPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "StatusToMentions": { + "name": "StatusToMentions", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "StatusToMentions_A_B_index": { + "name": "StatusToMentions_A_B_index", + "columns": ["A", "B"], + "isUnique": true + }, + "StatusToMentions_B_index": { + "name": "StatusToMentions_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "StatusToMentions_A_Status_id_fk": { + "name": "StatusToMentions_A_Status_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "Status", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "StatusToMentions_B_User_id_fk": { + "name": "StatusToMentions_B_User_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "isAdmin": { + "name": "isAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "isBot": { + "name": "isBot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isLocked": { + "name": "isLocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isDiscoverable": { + "name": "isDiscoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_key": { + "name": "User_uri_key", + "columns": ["uri"], + "isUnique": true + }, + "User_username_key": { + "name": "User_username_key", + "columns": ["username"], + "isUnique": true + }, + "User_email_key": { + "name": "User_email_key", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_UserPinnedNotes": { + "name": "_UserPinnedNotes", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_UserPinnedNotes_AB_unique": { + "name": "_UserPinnedNotes_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_UserPinnedNotes_B_index": { + "name": "_UserPinnedNotes_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_UserPinnedNotes_A_Status_id_fk": { + "name": "_UserPinnedNotes_A_Status_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_UserPinnedNotes_B_User_id_fk": { + "name": "_UserPinnedNotes_B_User_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/0003_snapshot.json b/drizzle/meta/0003_snapshot.json new file mode 100644 index 00000000..049bee6e --- /dev/null +++ b/drizzle/meta/0003_snapshot.json @@ -0,0 +1,1588 @@ +{ + "id": "e42512a1-5533-44ae-9f58-f2da4964c9d1", + "prevId": "da4a79a8-2655-4733-9886-77a286037ae6", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_key": { + "name": "Application_client_id_key", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToStatus": { + "name": "_EmojiToStatus", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToStatus_AB_unique": { + "name": "_EmojiToStatus_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToStatus_B_index": { + "name": "_EmojiToStatus_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToStatus_A_Emoji_id_fk": { + "name": "_EmojiToStatus_A_Emoji_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToStatus_B_Status_id_fk": { + "name": "_EmojiToStatus_B_Status_id_fk", + "tableFrom": "_EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToUser": { + "name": "_EmojiToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToUser_AB_unique": { + "name": "_EmojiToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToUser_B_index": { + "name": "_EmojiToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToUser_A_Emoji_id_fk": { + "name": "_EmojiToUser_A_Emoji_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToUser_B_User_id_fk": { + "name": "_EmojiToUser_B_User_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flagType": { + "name": "flagType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_key": { + "name": "LysandObject_remote_id_key", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_key": { + "name": "LysandObject_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_fkey": { + "name": "LysandObject_authorId_fkey", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serverId": { + "name": "serverId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "codeVerifier": { + "name": "codeVerifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showingReblogs": { + "name": "showingReblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followedBy": { + "name": "followedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blockedBy": { + "name": "blockedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "mutingNotifications": { + "name": "mutingNotifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domainBlocking": { + "name": "domainBlocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "contentType": { + "name": "contentType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoilerText": { + "name": "spoilerText", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contentSource": { + "name": "contentSource", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_key": { + "name": "Status_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_fkey": { + "name": "Status_reblogId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_fkey": { + "name": "Status_inReplyToPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_fkey": { + "name": "Status_quotingPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "StatusToMentions": { + "name": "StatusToMentions", + "schema": "", + "columns": { + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "StatusToMentions_statusId_userId_index": { + "name": "StatusToMentions_statusId_userId_index", + "columns": ["statusId", "userId"], + "isUnique": true + }, + "StatusToMentions_userId_index": { + "name": "StatusToMentions_userId_index", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": { + "StatusToMentions_statusId_Status_id_fk": { + "name": "StatusToMentions_statusId_Status_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "StatusToMentions_userId_User_id_fk": { + "name": "StatusToMentions_userId_User_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "isAdmin": { + "name": "isAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "isBot": { + "name": "isBot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isLocked": { + "name": "isLocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isDiscoverable": { + "name": "isDiscoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_key": { + "name": "User_uri_key", + "columns": ["uri"], + "isUnique": true + }, + "User_username_key": { + "name": "User_username_key", + "columns": ["username"], + "isUnique": true + }, + "User_email_key": { + "name": "User_email_key", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_UserPinnedNotes": { + "name": "_UserPinnedNotes", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_UserPinnedNotes_AB_unique": { + "name": "_UserPinnedNotes_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_UserPinnedNotes_B_index": { + "name": "_UserPinnedNotes_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_UserPinnedNotes_A_Status_id_fk": { + "name": "_UserPinnedNotes_A_Status_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_UserPinnedNotes_B_User_id_fk": { + "name": "_UserPinnedNotes_B_User_id_fk", + "tableFrom": "_UserPinnedNotes", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/0004_snapshot.json b/drizzle/meta/0004_snapshot.json new file mode 100644 index 00000000..6f2a9e07 --- /dev/null +++ b/drizzle/meta/0004_snapshot.json @@ -0,0 +1,1588 @@ +{ + "id": "e3c6cea6-a278-407d-a436-2e139c0bdf29", + "prevId": "e42512a1-5533-44ae-9f58-f2da4964c9d1", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_key": { + "name": "Application_client_id_key", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "EmojiToStatus": { + "name": "EmojiToStatus", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToStatus_emojiId_statusId_index": { + "name": "EmojiToStatus_emojiId_statusId_index", + "columns": ["emojiId", "statusId"], + "isUnique": true + }, + "EmojiToStatus_statusId_index": { + "name": "EmojiToStatus_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "EmojiToStatus_emojiId_Emoji_id_fk": { + "name": "EmojiToStatus_emojiId_Emoji_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToStatus_statusId_Status_id_fk": { + "name": "EmojiToStatus_statusId_Status_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToUser": { + "name": "_EmojiToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToUser_AB_unique": { + "name": "_EmojiToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToUser_B_index": { + "name": "_EmojiToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToUser_A_Emoji_id_fk": { + "name": "_EmojiToUser_A_Emoji_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToUser_B_User_id_fk": { + "name": "_EmojiToUser_B_User_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flagType": { + "name": "flagType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_index": { + "name": "LysandObject_remote_id_index", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_index": { + "name": "LysandObject_uri_index", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_LysandObject_id_fk": { + "name": "LysandObject_authorId_LysandObject_id_fk", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serverId": { + "name": "serverId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "codeVerifier": { + "name": "codeVerifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showingReblogs": { + "name": "showingReblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followedBy": { + "name": "followedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blockedBy": { + "name": "blockedBy", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "mutingNotifications": { + "name": "mutingNotifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domainBlocking": { + "name": "domainBlocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "contentType": { + "name": "contentType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoilerText": { + "name": "spoilerText", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "contentSource": { + "name": "contentSource", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_key": { + "name": "Status_uri_key", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_fkey": { + "name": "Status_reblogId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_fkey": { + "name": "Status_inReplyToPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_fkey": { + "name": "Status_quotingPostId_fkey", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "StatusToMentions": { + "name": "StatusToMentions", + "schema": "", + "columns": { + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "StatusToMentions_statusId_userId_index": { + "name": "StatusToMentions_statusId_userId_index", + "columns": ["statusId", "userId"], + "isUnique": true + }, + "StatusToMentions_userId_index": { + "name": "StatusToMentions_userId_index", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": { + "StatusToMentions_statusId_Status_id_fk": { + "name": "StatusToMentions_statusId_Status_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "StatusToMentions_userId_User_id_fk": { + "name": "StatusToMentions_userId_User_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "isAdmin": { + "name": "isAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "isBot": { + "name": "isBot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isLocked": { + "name": "isLocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isDiscoverable": { + "name": "isDiscoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_key": { + "name": "User_uri_key", + "columns": ["uri"], + "isUnique": true + }, + "User_username_key": { + "name": "User_username_key", + "columns": ["username"], + "isUnique": true + }, + "User_email_key": { + "name": "User_email_key", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "UserToPinnedNotes": { + "name": "UserToPinnedNotes", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "UserToPinnedNotes_userId_statusId_index": { + "name": "UserToPinnedNotes_userId_statusId_index", + "columns": ["userId", "statusId"], + "isUnique": true + }, + "UserToPinnedNotes_statusId_index": { + "name": "UserToPinnedNotes_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "UserToPinnedNotes_userId_Status_id_fk": { + "name": "UserToPinnedNotes_userId_Status_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "UserToPinnedNotes_statusId_User_id_fk": { + "name": "UserToPinnedNotes_statusId_User_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "User", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/0005_snapshot.json b/drizzle/meta/0005_snapshot.json new file mode 100644 index 00000000..1414d0a9 --- /dev/null +++ b/drizzle/meta/0005_snapshot.json @@ -0,0 +1,1590 @@ +{ + "id": "58ace775-4463-4ea9-8585-a8db47dbd286", + "prevId": "e3c6cea6-a278-407d-a436-2e139c0bdf29", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_index": { + "name": "Application_client_id_index", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "EmojiToStatus": { + "name": "EmojiToStatus", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToStatus_emojiId_statusId_index": { + "name": "EmojiToStatus_emojiId_statusId_index", + "columns": ["emojiId", "statusId"], + "isUnique": true + }, + "EmojiToStatus_statusId_index": { + "name": "EmojiToStatus_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "EmojiToStatus_emojiId_Emoji_id_fk": { + "name": "EmojiToStatus_emojiId_Emoji_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToStatus_statusId_Status_id_fk": { + "name": "EmojiToStatus_statusId_Status_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "_EmojiToUser": { + "name": "_EmojiToUser", + "schema": "", + "columns": { + "A": { + "name": "A", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "B": { + "name": "B", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "_EmojiToUser_AB_unique": { + "name": "_EmojiToUser_AB_unique", + "columns": ["A", "B"], + "isUnique": true + }, + "_EmojiToUser_B_index": { + "name": "_EmojiToUser_B_index", + "columns": ["B"], + "isUnique": false + } + }, + "foreignKeys": { + "_EmojiToUser_A_Emoji_id_fk": { + "name": "_EmojiToUser_A_Emoji_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["A"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "_EmojiToUser_B_User_id_fk": { + "name": "_EmojiToUser_B_User_id_fk", + "tableFrom": "_EmojiToUser", + "tableTo": "User", + "columnsFrom": ["B"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flagType": { + "name": "flagType", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disable_automoderation": { + "name": "disable_automoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_index": { + "name": "LysandObject_remote_id_index", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_index": { + "name": "LysandObject_uri_index", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_LysandObject_id_fk": { + "name": "LysandObject_authorId_LysandObject_id_fk", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "serverId": { + "name": "serverId", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "codeVerifier": { + "name": "codeVerifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuerId": { + "name": "issuerId", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showing_reblogs": { + "name": "showing_reblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followed_by": { + "name": "followed_by", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocked_by": { + "name": "blocked_by", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting_notifications": { + "name": "muting_notifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domain_blocking": { + "name": "domain_blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoiler_text": { + "name": "spoiler_text", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content_source": { + "name": "content_source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_index": { + "name": "Status_uri_index", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_Status_id_fk": { + "name": "Status_reblogId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_Status_id_fk": { + "name": "Status_inReplyToPostId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_Status_id_fk": { + "name": "Status_quotingPostId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "StatusToMentions": { + "name": "StatusToMentions", + "schema": "", + "columns": { + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "StatusToMentions_statusId_userId_index": { + "name": "StatusToMentions_statusId_userId_index", + "columns": ["statusId", "userId"], + "isUnique": true + }, + "StatusToMentions_userId_index": { + "name": "StatusToMentions_userId_index", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": { + "StatusToMentions_statusId_Status_id_fk": { + "name": "StatusToMentions_statusId_Status_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "StatusToMentions_userId_User_id_fk": { + "name": "StatusToMentions_userId_User_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "displayName": { + "name": "displayName", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "isAdmin": { + "name": "isAdmin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "isBot": { + "name": "isBot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isLocked": { + "name": "isLocked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "isDiscoverable": { + "name": "isDiscoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "publicKey": { + "name": "publicKey", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "privateKey": { + "name": "privateKey", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disableAutomoderation": { + "name": "disableAutomoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_key": { + "name": "User_uri_key", + "columns": ["uri"], + "isUnique": true + }, + "User_username_key": { + "name": "User_username_key", + "columns": ["username"], + "isUnique": true + }, + "User_email_key": { + "name": "User_email_key", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "UserToPinnedNotes": { + "name": "UserToPinnedNotes", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "UserToPinnedNotes_userId_statusId_index": { + "name": "UserToPinnedNotes_userId_statusId_index", + "columns": ["userId", "statusId"], + "isUnique": true + }, + "UserToPinnedNotes_statusId_index": { + "name": "UserToPinnedNotes_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "UserToPinnedNotes_userId_Status_id_fk": { + "name": "UserToPinnedNotes_userId_Status_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "UserToPinnedNotes_statusId_User_id_fk": { + "name": "UserToPinnedNotes_statusId_User_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "User", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/0006_snapshot.json b/drizzle/meta/0006_snapshot.json new file mode 100644 index 00000000..a5c49b0d --- /dev/null +++ b/drizzle/meta/0006_snapshot.json @@ -0,0 +1,1590 @@ +{ + "id": "47f76353-0b58-4367-b273-8933b7c89e1f", + "prevId": "58ace775-4463-4ea9-8585-a8db47dbd286", + "version": "5", + "dialect": "pg", + "tables": { + "Application": { + "name": "Application", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "website": { + "name": "website", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "vapid_key": { + "name": "vapid_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "client_id": { + "name": "client_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scopes": { + "name": "scopes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "redirect_uris": { + "name": "redirect_uris", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "Application_client_id_index": { + "name": "Application_client_id_index", + "columns": ["client_id"], + "isUnique": true + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Attachment": { + "name": "Attachment", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "remote_url": { + "name": "remote_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "thumbnail_url": { + "name": "thumbnail_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "mime_type": { + "name": "mime_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "blurhash": { + "name": "blurhash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sha256": { + "name": "sha256", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "fps": { + "name": "fps", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "duration": { + "name": "duration", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "width": { + "name": "width", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "height": { + "name": "height", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "size": { + "name": "size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Attachment_statusId_Status_id_fk": { + "name": "Attachment_statusId_Status_id_fk", + "tableFrom": "Attachment", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Emoji": { + "name": "Emoji", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "shortcode": { + "name": "shortcode", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url": { + "name": "url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "visible_in_picker": { + "name": "visible_in_picker", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "alt": { + "name": "alt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Emoji_instanceId_Instance_id_fk": { + "name": "Emoji_instanceId_Instance_id_fk", + "tableFrom": "Emoji", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "EmojiToStatus": { + "name": "EmojiToStatus", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToStatus_emojiId_statusId_index": { + "name": "EmojiToStatus_emojiId_statusId_index", + "columns": ["emojiId", "statusId"], + "isUnique": true + }, + "EmojiToStatus_statusId_index": { + "name": "EmojiToStatus_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "EmojiToStatus_emojiId_Emoji_id_fk": { + "name": "EmojiToStatus_emojiId_Emoji_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Emoji", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToStatus_statusId_Status_id_fk": { + "name": "EmojiToStatus_statusId_Status_id_fk", + "tableFrom": "EmojiToStatus", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "EmojiToUser": { + "name": "EmojiToUser", + "schema": "", + "columns": { + "emojiId": { + "name": "emojiId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "EmojiToUser_emojiId_userId_index": { + "name": "EmojiToUser_emojiId_userId_index", + "columns": ["emojiId", "userId"], + "isUnique": true + }, + "EmojiToUser_userId_index": { + "name": "EmojiToUser_userId_index", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": { + "EmojiToUser_emojiId_Emoji_id_fk": { + "name": "EmojiToUser_emojiId_Emoji_id_fk", + "tableFrom": "EmojiToUser", + "tableTo": "Emoji", + "columnsFrom": ["emojiId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "EmojiToUser_userId_User_id_fk": { + "name": "EmojiToUser_userId_User_id_fk", + "tableFrom": "EmojiToUser", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Flag": { + "name": "Flag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "flag_type": { + "name": "flag_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'other'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "flaggeStatusId": { + "name": "flaggeStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "flaggedUserId": { + "name": "flaggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Flag_flaggeStatusId_Status_id_fk": { + "name": "Flag_flaggeStatusId_Status_id_fk", + "tableFrom": "Flag", + "tableTo": "Status", + "columnsFrom": ["flaggeStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Flag_flaggedUserId_User_id_fk": { + "name": "Flag_flaggedUserId_User_id_fk", + "tableFrom": "Flag", + "tableTo": "User", + "columnsFrom": ["flaggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Instance": { + "name": "Instance", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "base_url": { + "name": "base_url", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "version": { + "name": "version", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "logo": { + "name": "logo", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "disable_automoderation": { + "name": "disable_automoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Like": { + "name": "Like", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "likerId": { + "name": "likerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "likedId": { + "name": "likedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Like_likerId_User_id_fk": { + "name": "Like_likerId_User_id_fk", + "tableFrom": "Like", + "tableTo": "User", + "columnsFrom": ["likerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Like_likedId_Status_id_fk": { + "name": "Like_likedId_Status_id_fk", + "tableFrom": "Like", + "tableTo": "Status", + "columnsFrom": ["likedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "LysandObject": { + "name": "LysandObject", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "remote_id": { + "name": "remote_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "extra_data": { + "name": "extra_data", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "extensions": { + "name": "extensions", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "LysandObject_remote_id_index": { + "name": "LysandObject_remote_id_index", + "columns": ["remote_id"], + "isUnique": true + }, + "LysandObject_uri_index": { + "name": "LysandObject_uri_index", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "LysandObject_authorId_LysandObject_id_fk": { + "name": "LysandObject_authorId_LysandObject_id_fk", + "tableFrom": "LysandObject", + "tableTo": "LysandObject", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModNote": { + "name": "ModNote", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "notedStatusId": { + "name": "notedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "notedUserId": { + "name": "notedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModNote_notedStatusId_Status_id_fk": { + "name": "ModNote_notedStatusId_Status_id_fk", + "tableFrom": "ModNote", + "tableTo": "Status", + "columnsFrom": ["notedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_notedUserId_User_id_fk": { + "name": "ModNote_notedUserId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["notedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModNote_modId_User_id_fk": { + "name": "ModNote_modId_User_id_fk", + "tableFrom": "ModNote", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "ModTag": { + "name": "ModTag", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "taggedStatusId": { + "name": "taggedStatusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "taggedUserId": { + "name": "taggedUserId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "modId": { + "name": "modId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "tag": { + "name": "tag", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "ModTag_taggedStatusId_Status_id_fk": { + "name": "ModTag_taggedStatusId_Status_id_fk", + "tableFrom": "ModTag", + "tableTo": "Status", + "columnsFrom": ["taggedStatusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_taggedUserId_User_id_fk": { + "name": "ModTag_taggedUserId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["taggedUserId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "ModTag_modId_User_id_fk": { + "name": "ModTag_modId_User_id_fk", + "tableFrom": "ModTag", + "tableTo": "User", + "columnsFrom": ["modId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Notification": { + "name": "Notification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "notifiedId": { + "name": "notifiedId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "accountId": { + "name": "accountId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Notification_notifiedId_User_id_fk": { + "name": "Notification_notifiedId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["notifiedId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_accountId_User_id_fk": { + "name": "Notification_accountId_User_id_fk", + "tableFrom": "Notification", + "tableTo": "User", + "columnsFrom": ["accountId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Notification_statusId_Status_id_fk": { + "name": "Notification_statusId_Status_id_fk", + "tableFrom": "Notification", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdAccount": { + "name": "OpenIdAccount", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdAccount_userId_User_id_fk": { + "name": "OpenIdAccount_userId_User_id_fk", + "tableFrom": "OpenIdAccount", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "OpenIdLoginFlow": { + "name": "OpenIdLoginFlow", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "code_verifier": { + "name": "code_verifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "issuer_id": { + "name": "issuer_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "OpenIdLoginFlow_applicationId_Application_id_fk": { + "name": "OpenIdLoginFlow_applicationId_Application_id_fk", + "tableFrom": "OpenIdLoginFlow", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Relationship": { + "name": "Relationship", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "ownerId": { + "name": "ownerId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "subjectId": { + "name": "subjectId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "following": { + "name": "following", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "showing_reblogs": { + "name": "showing_reblogs", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "notifying": { + "name": "notifying", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "followed_by": { + "name": "followed_by", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocking": { + "name": "blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "blocked_by": { + "name": "blocked_by", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting": { + "name": "muting", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "muting_notifications": { + "name": "muting_notifications", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "requested": { + "name": "requested", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "domain_blocking": { + "name": "domain_blocking", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "endorsed": { + "name": "endorsed", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "languages": { + "name": "languages", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "Relationship_ownerId_User_id_fk": { + "name": "Relationship_ownerId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["ownerId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Relationship_subjectId_User_id_fk": { + "name": "Relationship_subjectId_User_id_fk", + "tableFrom": "Relationship", + "tableTo": "User", + "columnsFrom": ["subjectId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Status": { + "name": "Status", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "authorId": { + "name": "authorId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "createdAt": { + "name": "createdAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updatedAt": { + "name": "updatedAt", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "reblogId": { + "name": "reblogId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "content_type": { + "name": "content_type", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'text/plain'" + }, + "visibility": { + "name": "visibility", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "inReplyToPostId": { + "name": "inReplyToPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "quotingPostId": { + "name": "quotingPostId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "sensitive": { + "name": "sensitive", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "spoiler_text": { + "name": "spoiler_text", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "content_source": { + "name": "content_source", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "Status_uri_index": { + "name": "Status_uri_index", + "columns": ["uri"], + "isUnique": true + } + }, + "foreignKeys": { + "Status_authorId_User_id_fk": { + "name": "Status_authorId_User_id_fk", + "tableFrom": "Status", + "tableTo": "User", + "columnsFrom": ["authorId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_instanceId_Instance_id_fk": { + "name": "Status_instanceId_Instance_id_fk", + "tableFrom": "Status", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_applicationId_Application_id_fk": { + "name": "Status_applicationId_Application_id_fk", + "tableFrom": "Status", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_reblogId_Status_id_fk": { + "name": "Status_reblogId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["reblogId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Status_inReplyToPostId_Status_id_fk": { + "name": "Status_inReplyToPostId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["inReplyToPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + }, + "Status_quotingPostId_Status_id_fk": { + "name": "Status_quotingPostId_Status_id_fk", + "tableFrom": "Status", + "tableTo": "Status", + "columnsFrom": ["quotingPostId"], + "columnsTo": ["id"], + "onDelete": "set null", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "StatusToMentions": { + "name": "StatusToMentions", + "schema": "", + "columns": { + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "StatusToMentions_statusId_userId_index": { + "name": "StatusToMentions_statusId_userId_index", + "columns": ["statusId", "userId"], + "isUnique": true + }, + "StatusToMentions_userId_index": { + "name": "StatusToMentions_userId_index", + "columns": ["userId"], + "isUnique": false + } + }, + "foreignKeys": { + "StatusToMentions_statusId_Status_id_fk": { + "name": "StatusToMentions_statusId_Status_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "Status", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "StatusToMentions_userId_User_id_fk": { + "name": "StatusToMentions_userId_User_id_fk", + "tableFrom": "StatusToMentions", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "Token": { + "name": "Token", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "code": { + "name": "code", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "applicationId": { + "name": "applicationId", + "type": "uuid", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "Token_userId_User_id_fk": { + "name": "Token_userId_User_id_fk", + "tableFrom": "Token", + "tableTo": "User", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "Token_applicationId_Application_id_fk": { + "name": "Token_applicationId_Application_id_fk", + "tableFrom": "Token", + "tableTo": "Application", + "columnsFrom": ["applicationId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "User": { + "name": "User", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "uuid_generate_v7()" + }, + "uri": { + "name": "uri", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "display_name": { + "name": "display_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "note": { + "name": "note", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "is_admin": { + "name": "is_admin", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "endpoints": { + "name": "endpoints", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "header": { + "name": "header", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp(3)", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "is_bot": { + "name": "is_bot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_locked": { + "name": "is_locked", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "is_discoverable": { + "name": "is_discoverable", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "sanctions": { + "name": "sanctions", + "type": "text[]", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "instanceId": { + "name": "instanceId", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "disable_automoderation": { + "name": "disable_automoderation", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + } + }, + "indexes": { + "User_uri_index": { + "name": "User_uri_index", + "columns": ["uri"], + "isUnique": true + }, + "User_username_index": { + "name": "User_username_index", + "columns": ["username"], + "isUnique": true + }, + "User_email_index": { + "name": "User_email_index", + "columns": ["email"], + "isUnique": true + } + }, + "foreignKeys": { + "User_instanceId_Instance_id_fk": { + "name": "User_instanceId_Instance_id_fk", + "tableFrom": "User", + "tableTo": "Instance", + "columnsFrom": ["instanceId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + }, + "UserToPinnedNotes": { + "name": "UserToPinnedNotes", + "schema": "", + "columns": { + "userId": { + "name": "userId", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "statusId": { + "name": "statusId", + "type": "uuid", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "UserToPinnedNotes_userId_statusId_index": { + "name": "UserToPinnedNotes_userId_statusId_index", + "columns": ["userId", "statusId"], + "isUnique": true + }, + "UserToPinnedNotes_statusId_index": { + "name": "UserToPinnedNotes_statusId_index", + "columns": ["statusId"], + "isUnique": false + } + }, + "foreignKeys": { + "UserToPinnedNotes_userId_Status_id_fk": { + "name": "UserToPinnedNotes_userId_Status_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "Status", + "columnsFrom": ["userId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + }, + "UserToPinnedNotes_statusId_User_id_fk": { + "name": "UserToPinnedNotes_statusId_User_id_fk", + "tableFrom": "UserToPinnedNotes", + "tableTo": "User", + "columnsFrom": ["statusId"], + "columnsTo": ["id"], + "onDelete": "cascade", + "onUpdate": "cascade" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {} + } + }, + "enums": {}, + "schemas": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index e80d9a91..0f160f1e 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -8,6 +8,48 @@ "when": 1712805159664, "tag": "0000_illegal_living_lightning", "breakpoints": true + }, + { + "idx": 1, + "version": "5", + "when": 1713055774123, + "tag": "0001_salty_night_thrasher", + "breakpoints": true + }, + { + "idx": 2, + "version": "5", + "when": 1713056370431, + "tag": "0002_stiff_ares", + "breakpoints": true + }, + { + "idx": 3, + "version": "5", + "when": 1713056528340, + "tag": "0003_spicy_arachne", + "breakpoints": true + }, + { + "idx": 4, + "version": "5", + "when": 1713056712218, + "tag": "0004_burly_lockjaw", + "breakpoints": true + }, + { + "idx": 5, + "version": "5", + "when": 1713056917973, + "tag": "0005_sleepy_puma", + "breakpoints": true + }, + { + "idx": 6, + "version": "5", + "when": 1713057159867, + "tag": "0006_messy_network", + "breakpoints": true } ] } diff --git a/drizzle/schema.ts b/drizzle/schema.ts index 1d0cf319..b4f4d1b6 100644 --- a/drizzle/schema.ts +++ b/drizzle/schema.ts @@ -60,14 +60,11 @@ export const lysandObject = pgTable( }, (table) => { return { - remoteIdKey: uniqueIndex("LysandObject_remote_id_key").on( - table.remoteId, - ), - uriKey: uniqueIndex("LysandObject_uri_key").on(table.uri), + remoteIdKey: uniqueIndex().on(table.remoteId), + uriKey: uniqueIndex().on(table.uri), lysandObjectAuthorIdFkey: foreignKey({ columns: [table.authorId], foreignColumns: [table.id], - name: "LysandObject_authorId_fkey", }) .onUpdate("cascade") .onDelete("cascade"), @@ -90,25 +87,27 @@ export const relationship = pgTable("Relationship", { onUpdate: "cascade", }), following: boolean("following").notNull(), - showingReblogs: boolean("showingReblogs").notNull(), + showingReblogs: boolean("showing_reblogs").notNull(), notifying: boolean("notifying").notNull(), - followedBy: boolean("followedBy").notNull(), + followedBy: boolean("followed_by").notNull(), blocking: boolean("blocking").notNull(), - blockedBy: boolean("blockedBy").notNull(), + blockedBy: boolean("blocked_by").notNull(), muting: boolean("muting").notNull(), - mutingNotifications: boolean("mutingNotifications").notNull(), + mutingNotifications: boolean("muting_notifications").notNull(), requested: boolean("requested").notNull(), - domainBlocking: boolean("domainBlocking").notNull(), + domainBlocking: boolean("domain_blocking").notNull(), endorsed: boolean("endorsed").notNull(), languages: text("languages").array(), note: text("note").notNull(), - createdAt: timestamp("createdAt", { precision: 3, mode: "string" }) + createdAt: timestamp("created_at", { precision: 3, mode: "string" }) .defaultNow() .notNull(), - updatedAt: timestamp("updatedAt", { + updatedAt: timestamp("updated_at", { precision: 3, mode: "string", - }).notNull(), + }) + .defaultNow() + .notNull(), }); export const application = pgTable( @@ -125,9 +124,7 @@ export const application = pgTable( }, (table) => { return { - clientIdKey: uniqueIndex("Application_client_id_key").on( - table.clientId, - ), + clientIdKey: uniqueIndex().on(table.clientId), }; }, ); @@ -217,10 +214,12 @@ export const status = pgTable( updatedAt: timestamp("updatedAt", { precision: 3, mode: "string", - }).notNull(), + }) + .defaultNow() + .notNull(), reblogId: uuid("reblogId"), content: text("content").default("").notNull(), - contentType: text("contentType").default("text/plain").notNull(), + contentType: text("content_type").default("text/plain").notNull(), visibility: text("visibility").notNull(), inReplyToPostId: uuid("inReplyToPostId"), quotingPostId: uuid("quotingPostId"), @@ -229,34 +228,31 @@ export const status = pgTable( onUpdate: "cascade", }), sensitive: boolean("sensitive").notNull(), - spoilerText: text("spoilerText").default("").notNull(), + spoilerText: text("spoiler_text").default("").notNull(), applicationId: uuid("applicationId").references(() => application.id, { onDelete: "set null", onUpdate: "cascade", }), - contentSource: text("contentSource").default("").notNull(), + contentSource: text("content_source").default("").notNull(), }, (table) => { return { - uriKey: uniqueIndex("Status_uri_key").on(table.uri), + uriKey: uniqueIndex().on(table.uri), statusReblogIdFkey: foreignKey({ columns: [table.reblogId], foreignColumns: [table.id], - name: "Status_reblogId_fkey", }) .onUpdate("cascade") .onDelete("cascade"), statusInReplyToPostIdFkey: foreignKey({ columns: [table.inReplyToPostId], foreignColumns: [table.id], - name: "Status_inReplyToPostId_fkey", }) .onUpdate("cascade") .onDelete("set null"), statusQuotingPostIdFkey: foreignKey({ columns: [table.quotingPostId], foreignColumns: [table.id], - name: "Status_quotingPostId_fkey", }) .onUpdate("cascade") .onDelete("set null"), @@ -270,7 +266,7 @@ export const instance = pgTable("Instance", { name: text("name").notNull(), version: text("version").notNull(), logo: jsonb("logo").notNull(), - disableAutomoderation: boolean("disableAutomoderation") + disableAutomoderation: boolean("disable_automoderation") .default(false) .notNull(), }); @@ -281,8 +277,8 @@ export const openIdAccount = pgTable("OpenIdAccount", { onDelete: "set null", onUpdate: "cascade", }), - serverId: text("serverId").notNull(), - issuerId: text("issuerId").notNull(), + serverId: text("server_id").notNull(), + issuerId: text("issuer_id").notNull(), }); export const user = pgTable( @@ -291,55 +287,55 @@ export const user = pgTable( id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(), uri: text("uri"), username: text("username").notNull(), - displayName: text("displayName").notNull(), + displayName: text("display_name").notNull(), password: text("password"), email: text("email"), note: text("note").default("").notNull(), - isAdmin: boolean("isAdmin").default(false).notNull(), + isAdmin: boolean("is_admin").default(false).notNull(), endpoints: jsonb("endpoints"), source: jsonb("source").notNull(), avatar: text("avatar").notNull(), header: text("header").notNull(), - createdAt: timestamp("createdAt", { precision: 3, mode: "string" }) + createdAt: timestamp("created_at", { precision: 3, mode: "string" }) .defaultNow() .notNull(), - updatedAt: timestamp("updatedAt", { + updatedAt: timestamp("updated_at", { precision: 3, mode: "string", }) .defaultNow() .notNull(), - isBot: boolean("isBot").default(false).notNull(), - isLocked: boolean("isLocked").default(false).notNull(), - isDiscoverable: boolean("isDiscoverable").default(false).notNull(), + isBot: boolean("is_bot").default(false).notNull(), + isLocked: boolean("is_locked").default(false).notNull(), + isDiscoverable: boolean("is_discoverable").default(false).notNull(), sanctions: text("sanctions").default("RRAY[").array(), - publicKey: text("publicKey").notNull(), - privateKey: text("privateKey"), + publicKey: text("public_key").notNull(), + privateKey: text("private_key"), instanceId: uuid("instanceId").references(() => instance.id, { onDelete: "cascade", onUpdate: "cascade", }), - disableAutomoderation: boolean("disableAutomoderation") + disableAutomoderation: boolean("disable_automoderation") .default(false) .notNull(), }, (table) => { return { - uriKey: uniqueIndex("User_uri_key").on(table.uri), - usernameKey: uniqueIndex("User_username_key").on(table.username), - emailKey: uniqueIndex("User_email_key").on(table.email), + uriKey: uniqueIndex().on(table.uri), + usernameKey: uniqueIndex().on(table.username), + emailKey: uniqueIndex().on(table.email), }; }, ); export const openIdLoginFlow = pgTable("OpenIdLoginFlow", { id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(), - codeVerifier: text("codeVerifier").notNull(), + codeVerifier: text("code_verifier").notNull(), applicationId: uuid("applicationId").references(() => application.id, { onDelete: "cascade", onUpdate: "cascade", }), - issuerId: text("issuerId").notNull(), + issuerId: text("issuer_id").notNull(), }); export const openIdLoginFlowRelations = relations( @@ -354,8 +350,8 @@ export const openIdLoginFlowRelations = relations( export const flag = pgTable("Flag", { id: uuid("id").default(sql`uuid_generate_v7()`).primaryKey().notNull(), - flagType: text("flagType").default("other").notNull(), - createdAt: timestamp("createdAt", { precision: 3, mode: "string" }) + flagType: text("flag_type").default("other").notNull(), + createdAt: timestamp("created_at", { precision: 3, mode: "string" }) .defaultNow() .notNull(), flaggeStatusId: uuid("flaggeStatusId").references(() => status.id, { @@ -385,7 +381,7 @@ export const modNote = pgTable("ModNote", { onUpdate: "cascade", }), note: text("note").notNull(), - createdAt: timestamp("createdAt", { precision: 3, mode: "string" }) + createdAt: timestamp("created_at", { precision: 3, mode: "string" }) .defaultNow() .notNull(), }); @@ -407,21 +403,21 @@ export const modTag = pgTable("ModTag", { onUpdate: "cascade", }), tag: text("tag").notNull(), - createdAt: timestamp("createdAt", { precision: 3, mode: "string" }) + createdAt: timestamp("created_at", { precision: 3, mode: "string" }) .defaultNow() .notNull(), }); export const emojiToUser = pgTable( - "_EmojiToUser", + "EmojiToUser", { - a: uuid("A") + emojiId: uuid("emojiId") .notNull() .references(() => emoji.id, { onDelete: "cascade", onUpdate: "cascade", }), - b: uuid("B") + userId: uuid("userId") .notNull() .references(() => user.id, { onDelete: "cascade", @@ -430,36 +426,33 @@ export const emojiToUser = pgTable( }, (table) => { return { - abUnique: uniqueIndex("_EmojiToUser_AB_unique").on( - table.a, - table.b, - ), - bIdx: index().on(table.b), + abUnique: uniqueIndex().on(table.emojiId, table.userId), + bIdx: index().on(table.userId), }; }, ); export const emojiToUserRelations = relations(emojiToUser, ({ one }) => ({ emoji: one(emoji, { - fields: [emojiToUser.a], + fields: [emojiToUser.emojiId], references: [emoji.id], }), user: one(user, { - fields: [emojiToUser.b], + fields: [emojiToUser.userId], references: [user.id], }), })); export const emojiToStatus = pgTable( - "_EmojiToStatus", + "EmojiToStatus", { - a: uuid("A") + emojiId: uuid("emojiId") .notNull() .references(() => emoji.id, { onDelete: "cascade", onUpdate: "cascade", }), - b: uuid("B") + statusId: uuid("statusId") .notNull() .references(() => status.id, { onDelete: "cascade", @@ -468,25 +461,22 @@ export const emojiToStatus = pgTable( }, (table) => { return { - abUnique: uniqueIndex("_EmojiToStatus_AB_unique").on( - table.a, - table.b, - ), - bIdx: index().on(table.b), + abUnique: uniqueIndex().on(table.emojiId, table.statusId), + bIdx: index().on(table.statusId), }; }, ); -export const statusToUser = pgTable( - "_StatusToUser", +export const statusToMentions = pgTable( + "StatusToMentions", { - a: uuid("A") + statusId: uuid("statusId") .notNull() .references(() => status.id, { onDelete: "cascade", onUpdate: "cascade", }), - b: uuid("B") + userId: uuid("userId") .notNull() .references(() => user.id, { onDelete: "cascade", @@ -495,25 +485,22 @@ export const statusToUser = pgTable( }, (table) => { return { - abUnique: uniqueIndex("_StatusToUser_AB_unique").on( - table.a, - table.b, - ), - bIdx: index().on(table.b), + abUnique: uniqueIndex().on(table.statusId, table.userId), + bIdx: index().on(table.userId), }; }, ); export const userPinnedNotes = pgTable( - "_UserPinnedNotes", + "UserToPinnedNotes", { - a: uuid("A") + userId: uuid("userId") .notNull() .references(() => status.id, { onDelete: "cascade", onUpdate: "cascade", }), - b: uuid("B") + statusId: uuid("statusId") .notNull() .references(() => user.id, { onDelete: "cascade", @@ -522,11 +509,8 @@ export const userPinnedNotes = pgTable( }, (table) => { return { - abUnique: uniqueIndex("_UserPinnedNotes_AB_unique").on( - table.a, - table.b, - ), - bIdx: index().on(table.b), + abUnique: uniqueIndex().on(table.userId, table.statusId), + bIdx: index().on(table.statusId), }; }, ); @@ -566,7 +550,7 @@ export const userRelations = relations(user, ({ many, one }) => ({ fields: [user.instanceId], references: [instance.id], }), - mentionedIn: many(statusToUser), + mentionedIn: many(statusToMentions), })); export const relationshipRelations = relations(relationship, ({ one }) => ({ @@ -593,13 +577,13 @@ export const tokenRelations = relations(token, ({ one }) => ({ }), })); -export const statusToUserRelations = relations(statusToUser, ({ one }) => ({ +export const statusToUserRelations = relations(statusToMentions, ({ one }) => ({ status: one(status, { - fields: [statusToUser.a], + fields: [statusToMentions.statusId], references: [status.id], }), user: one(user, { - fields: [statusToUser.b], + fields: [statusToMentions.userId], references: [user.id], }), })); @@ -608,11 +592,11 @@ export const userPinnedNotesRelations = relations( userPinnedNotes, ({ one }) => ({ status: one(status, { - fields: [userPinnedNotes.a], + fields: [userPinnedNotes.statusId], references: [status.id], }), user: one(user, { - fields: [userPinnedNotes.b], + fields: [userPinnedNotes.userId], references: [user.id], }), }), @@ -626,7 +610,7 @@ export const statusRelations = relations(status, ({ many, one }) => ({ relationName: "StatusToAuthor", }), attachments: many(attachment), - mentions: many(statusToUser), + mentions: many(statusToMentions), reblog: one(status, { fields: [status.reblogId], references: [status.id], @@ -705,11 +689,11 @@ export const instanceRelations = relations(instance, ({ many }) => ({ export const emojiToStatusRelations = relations(emojiToStatus, ({ one }) => ({ emoji: one(emoji, { - fields: [emojiToStatus.a], + fields: [emojiToStatus.emojiId], references: [emoji.id], }), status: one(status, { - fields: [emojiToStatus.b], + fields: [emojiToStatus.statusId], references: [status.id], }), })); diff --git a/index.ts b/index.ts index de9af4a6..d56b3cdf 100644 --- a/index.ts +++ b/index.ts @@ -4,12 +4,16 @@ import { connectMeili } from "@meilisearch"; import { moduleIsEntry } from "@module"; import { config } from "config-manager"; import { count, sql } from "drizzle-orm"; +import { migrate } from "drizzle-orm/postgres-js/migrator"; import { LogLevel, LogManager, MultiLogManager } from "log-manager"; import { db, client as pgClient } from "~drizzle/db"; import { status } from "~drizzle/schema"; import { createServer } from "~server"; await pgClient.connect(); +await migrate(db, { + migrationsFolder: "./drizzle", +}); const timeAtStart = performance.now(); // Create requests file if it doesnt exist diff --git a/server/api/api/v1/accounts/[id]/statuses.ts b/server/api/api/v1/accounts/[id]/statuses.ts index 5a07e397..c9768864 100644 --- a/server/api/api/v1/accounts/[id]/statuses.ts +++ b/server/api/api/v1/accounts/[id]/statuses.ts @@ -66,7 +66,7 @@ export default apiRoute<{ since_id ? gte(status.id, since_id) : undefined, min_id ? gt(status.id, min_id) : undefined, eq(status.authorId, id), - sql`EXISTS (SELECT 1 FROM "_UserPinnedNotes" WHERE "_UserPinnedNotes"."A" = ${status.id} AND "_UserPinnedNotes"."B" = ${user.id})`, + sql`EXISTS (SELECT 1 FROM "UserToPinnedNotes" WHERE "UserToPinnedNotes"."statusId" = ${status.id} AND "UserToPinnedNotes"."userId" = ${user.id})`, only_media ? sql`EXISTS (SELECT 1 FROM "Attachment" WHERE "Attachment"."statusId" = ${status.id})` : undefined, diff --git a/server/api/api/v1/statuses/[id]/pin.ts b/server/api/api/v1/statuses/[id]/pin.ts index 88c1bbf4..d279755e 100644 --- a/server/api/api/v1/statuses/[id]/pin.ts +++ b/server/api/api/v1/statuses/[id]/pin.ts @@ -2,7 +2,7 @@ import { apiRoute, applyConfig } from "@api"; import { errorResponse, jsonResponse } from "@response"; import { findFirstStatuses, statusToAPI } from "~database/entities/Status"; import { db } from "~drizzle/db"; -import { statusToUser } from "~drizzle/schema"; +import { statusToMentions } from "~drizzle/schema"; export const meta = applyConfig({ allowedMethods: ["POST"], @@ -50,7 +50,7 @@ export default apiRoute(async (req, matchedRoute, extraData) => { return errorResponse("Already pinned", 422); } - await db.insert(statusToUser).values({ + await db.insert(statusToMentions).values({ a: foundStatus.id, b: user.id, }); diff --git a/server/api/api/v1/statuses/[id]/unpin.ts b/server/api/api/v1/statuses/[id]/unpin.ts index 1590bf74..e0da0fe9 100644 --- a/server/api/api/v1/statuses/[id]/unpin.ts +++ b/server/api/api/v1/statuses/[id]/unpin.ts @@ -3,7 +3,7 @@ import { errorResponse, jsonResponse } from "@response"; import { and, eq } from "drizzle-orm"; import { findFirstStatuses, statusToAPI } from "~database/entities/Status"; import { db } from "~drizzle/db"; -import { statusToUser } from "~drizzle/schema"; +import { statusToMentions } from "~drizzle/schema"; export const meta = applyConfig({ allowedMethods: ["POST"], @@ -38,8 +38,13 @@ export default apiRoute(async (req, matchedRoute, extraData) => { if (status.authorId !== user.id) return errorResponse("Unauthorized", 401); await db - .delete(statusToUser) - .where(and(eq(statusToUser.a, status.id), eq(statusToUser.b, user.id))); + .delete(statusToMentions) + .where( + and( + eq(statusToMentions.statusId, status.id), + eq(statusToMentions.userId, user.id), + ), + ); if (!status) return errorResponse("Record not found", 404); diff --git a/server/api/api/v1/timelines/home.ts b/server/api/api/v1/timelines/home.ts index 33f01f98..7a3aa27b 100644 --- a/server/api/api/v1/timelines/home.ts +++ b/server/api/api/v1/timelines/home.ts @@ -66,7 +66,7 @@ export default apiRoute<{ ), */ // All statuses where the user is mentioned, using table _StatusToUser which has a: status.id and b: user.id // WHERE format (... = ...) - sql`EXISTS (SELECT 1 FROM "_StatusToUser" WHERE "_StatusToUser"."A" = ${status.id} AND "_StatusToUser"."B" = ${user.id})`, + sql`EXISTS (SELECT 1 FROM "StatusToMentions" WHERE "StatusToMentions"."statusId" = ${status.id} AND "StatusToMentions"."userId" = ${user.id})`, // All statuses from users that the user is following // WHERE format (... = ...) sql`EXISTS (SELECT 1 FROM "Relationship" WHERE "Relationship"."subjectId" = ${status.authorId} AND "Relationship"."ownerId" = ${user.id} AND "Relationship"."following" = true)`, diff --git a/tests/oauth.test.ts b/tests/oauth.test.ts index 0bad31a1..fbd0fed8 100644 --- a/tests/oauth.test.ts +++ b/tests/oauth.test.ts @@ -1,12 +1,12 @@ import { afterAll, describe, expect, test } from "bun:test"; import type { APIApplication } from "~types/entities/application"; +import type { APIToken } from "~types/entities/token"; import { deleteOldTestUsers, getTestUsers, sendTestRequest, wrapRelativeUrl, } from "./utils"; -import type { APIToken } from "~types/entities/token"; const base_url = "http://lysand.localhost:8080"; //config.http.base_url;