diff --git a/bun.lockb b/bun.lockb index ed14116..d242f82 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/generated/graphql/schema.executable.ts b/src/generated/graphql/schema.executable.ts index f9a3768..21301cb 100644 --- a/src/generated/graphql/schema.executable.ts +++ b/src/generated/graphql/schema.executable.ts @@ -120,7 +120,7 @@ const spec_userOrganization = { }), description: undefined, extensions: { - oid: "77872", + oid: "92823", isTableLike: true, pg: { serviceName: "main", @@ -200,7 +200,7 @@ const spec_downvote = { }), description: undefined, extensions: { - oid: "78725", + oid: "92888", isTableLike: true, pg: { serviceName: "main", @@ -280,7 +280,7 @@ const spec_upvote = { }), description: undefined, extensions: { - oid: "77850", + oid: "92801", isTableLike: true, pg: { serviceName: "main", @@ -360,7 +360,7 @@ const spec_organization = { }), description: undefined, extensions: { - oid: "77812", + oid: "92763", isTableLike: true, pg: { serviceName: "main", @@ -452,7 +452,7 @@ const spec_comment = { }), description: undefined, extensions: { - oid: "78467", + oid: "92868", isTableLike: true, pg: { serviceName: "main", @@ -556,7 +556,7 @@ const spec_post = { }), description: undefined, extensions: { - oid: "77826", + oid: "92777", isTableLike: true, pg: { serviceName: "main", @@ -672,7 +672,7 @@ const spec_project = { }), description: undefined, extensions: { - oid: "77836", + oid: "92787", isTableLike: true, pg: { serviceName: "main", @@ -776,7 +776,7 @@ const spec_user = { }), description: undefined, extensions: { - oid: "77860", + oid: "92811", isTableLike: true, pg: { serviceName: "main", diff --git a/src/lib/drizzle/schema/comment.table.ts b/src/lib/drizzle/schema/comment.table.ts index d81aa58..ca9be3f 100644 --- a/src/lib/drizzle/schema/comment.table.ts +++ b/src/lib/drizzle/schema/comment.table.ts @@ -1,4 +1,3 @@ -import { relations } from "drizzle-orm"; import { pgTable, text, uuid } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; @@ -27,20 +26,6 @@ export const comments = pgTable("comment", { updatedAt: defaultDate(), }); -/** - * Relations for the comment table. - */ -export const commentRelations = relations(comments, ({ one }) => ({ - post: one(posts, { - fields: [comments.postId], - references: [posts.id], - }), - user: one(users, { - fields: [comments.userId], - references: [users.id], - }), -})); - /** * Type helpers related to the comment table. */ diff --git a/src/lib/drizzle/schema/downvote.table.ts b/src/lib/drizzle/schema/downvote.table.ts index 9aab720..264af47 100644 --- a/src/lib/drizzle/schema/downvote.table.ts +++ b/src/lib/drizzle/schema/downvote.table.ts @@ -1,4 +1,3 @@ -import { relations } from "drizzle-orm"; import { pgTable, unique, uuid } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; @@ -30,20 +29,6 @@ export const downvotes = pgTable( (table) => [unique().on(table.postId, table.userId)] ); -/** - * Relations for the downvote table. - */ -export const downvoteRelations = relations(downvotes, ({ one }) => ({ - post: one(posts, { - fields: [downvotes.postId], - references: [posts.id], - }), - user: one(users, { - fields: [downvotes.userId], - references: [users.id], - }), -})); - /** * Type helpers related to the downvote table. */ diff --git a/src/lib/drizzle/schema/organization.table.ts b/src/lib/drizzle/schema/organization.table.ts index cd3dae7..456f389 100644 --- a/src/lib/drizzle/schema/organization.table.ts +++ b/src/lib/drizzle/schema/organization.table.ts @@ -1,9 +1,6 @@ -import { relations } from "drizzle-orm"; import { pgTable, text } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; -import { projects } from "./project.table"; -import { usersToOrganizations } from "./userToOrganization.table"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; @@ -18,14 +15,6 @@ export const organizations = pgTable("organization", { updatedAt: defaultDate(), }); -/** - * Relations for the organization table. - */ -export const organizationRelations = relations(organizations, ({ many }) => ({ - projects: many(projects), - users: many(usersToOrganizations), -})); - /** * Type helpers related to the organization table. */ diff --git a/src/lib/drizzle/schema/post.table.ts b/src/lib/drizzle/schema/post.table.ts index 61f3c9b..0e9be52 100644 --- a/src/lib/drizzle/schema/post.table.ts +++ b/src/lib/drizzle/schema/post.table.ts @@ -1,11 +1,7 @@ -import { relations } from "drizzle-orm"; import { pgTable, text, uuid } from "drizzle-orm/pg-core"; -import { comments } from "./comment.table"; import { defaultDate, defaultId } from "./constants"; -import { downvotes } from "./downvote.table"; import { projects } from "./project.table"; -import { upvotes } from "./upvote.table"; import { users } from "./user.table"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; @@ -31,23 +27,6 @@ export const posts = pgTable("post", { updatedAt: defaultDate(), }); -/** - * Relations for the post table. - */ -export const postRelations = relations(posts, ({ one, many }) => ({ - project: one(projects, { - fields: [posts.projectId], - references: [projects.id], - }), - user: one(users, { - fields: [posts.userId], - references: [users.id], - }), - comments: many(comments), - upvotes: many(upvotes), - downvotes: many(downvotes), -})); - /** * Type helpers related to the post table. */ diff --git a/src/lib/drizzle/schema/project.table.ts b/src/lib/drizzle/schema/project.table.ts index fee0047..fb1a349 100644 --- a/src/lib/drizzle/schema/project.table.ts +++ b/src/lib/drizzle/schema/project.table.ts @@ -1,9 +1,7 @@ -import { relations } from "drizzle-orm"; import { pgTable, text, unique, uuid } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; import { organizations } from "./organization.table"; -import { posts } from "./post.table"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; @@ -29,17 +27,6 @@ export const projects = pgTable( (table) => [unique().on(table.slug, table.organizationId)] ); -/** - * Relations for the project table. - */ -export const projectRelations = relations(projects, ({ one, many }) => ({ - organization: one(organizations, { - fields: [projects.organizationId], - references: [organizations.id], - }), - posts: many(posts), -})); - /** * Type helpers related to the project table. */ diff --git a/src/lib/drizzle/schema/upvote.table.ts b/src/lib/drizzle/schema/upvote.table.ts index a14780a..ada6cf9 100644 --- a/src/lib/drizzle/schema/upvote.table.ts +++ b/src/lib/drizzle/schema/upvote.table.ts @@ -1,4 +1,3 @@ -import { relations } from "drizzle-orm"; import { pgTable, unique, uuid } from "drizzle-orm/pg-core"; import { defaultDate, defaultId } from "./constants"; @@ -30,20 +29,6 @@ export const upvotes = pgTable( (table) => [unique().on(table.postId, table.userId)] ); -/** - * Relations for the upvote table. - */ -export const upvoteRelations = relations(upvotes, ({ one }) => ({ - post: one(posts, { - fields: [upvotes.postId], - references: [posts.id], - }), - user: one(users, { - fields: [upvotes.userId], - references: [users.id], - }), -})); - /** * Type helpers related to the upvote table. */ diff --git a/src/lib/drizzle/schema/user.table.ts b/src/lib/drizzle/schema/user.table.ts index 645e29e..1e9b190 100644 --- a/src/lib/drizzle/schema/user.table.ts +++ b/src/lib/drizzle/schema/user.table.ts @@ -1,12 +1,6 @@ -import { relations } from "drizzle-orm"; import { pgTable, text, uuid } from "drizzle-orm/pg-core"; -import { comments } from "./comment.table"; import { defaultDate, defaultId } from "./constants"; -import { downvotes } from "./downvote.table"; -import { posts } from "./post.table"; -import { upvotes } from "./upvote.table"; -import { usersToOrganizations } from "./userToOrganization.table"; import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; @@ -24,17 +18,6 @@ export const users = pgTable("user", { updatedAt: defaultDate(), }); -/** - * Relations for the user table. - */ -export const userRelations = relations(users, ({ many }) => ({ - organizations: many(usersToOrganizations), - posts: many(posts), - comments: many(comments), - upvotes: many(upvotes), - downvotes: many(downvotes), -})); - /** * Type helpers related to the user table. */ diff --git a/src/lib/drizzle/schema/userToOrganization.table.ts b/src/lib/drizzle/schema/userToOrganization.table.ts index 4478681..556074b 100644 --- a/src/lib/drizzle/schema/userToOrganization.table.ts +++ b/src/lib/drizzle/schema/userToOrganization.table.ts @@ -1,14 +1,11 @@ -import { - type InferInsertModel, - type InferSelectModel, - relations, -} from "drizzle-orm"; import { pgTable, unique, uuid } from "drizzle-orm/pg-core"; import { defaultDate } from "./constants"; import { organizations } from "./organization.table"; import { users } from "./user.table"; +import type { InferInsertModel, InferSelectModel } from "drizzle-orm"; + /** * Users to organizations join table. */ @@ -30,23 +27,6 @@ export const usersToOrganizations = pgTable( (table) => [unique().on(table.userId, table.organizationId)] ); -/** - * Relations for the users to organizations join table. - */ -export const usersToOrganizationsRelations = relations( - usersToOrganizations, - ({ one }) => ({ - user: one(users, { - fields: [usersToOrganizations.userId], - references: [users.id], - }), - organization: one(organizations, { - fields: [usersToOrganizations.organizationId], - references: [organizations.id], - }), - }) -); - /** * Type helpers related to the users to organizations join table. */