mirror of
https://github.com/nimbusdotstorage/Nimbus
synced 2026-04-22 17:45:03 +02:00
commit 17e50e79d662fda1ad7ad7f3e4b6b4b90cc6f588 Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 08:34:22 2025 -0400 full deployment github action. commit cf8bbf8d37b6428d902add914c7d70b18f5ec8cb Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 08:17:38 2025 -0400 cleaned up context used by server hono app. updated deps updated schema typing chore: knip commit a02bb69e7da02c01988b552342cfcd796154b08e Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 07:48:08 2025 -0400 first migration sql file has IF NOT EXISTS logic for everything commit b887c770e574427d70a46a7ff26a4eb0362b6147 Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 07:32:32 2025 -0400 drizzle-kit push to prod, then pulled from prod 2025-07-29 commit 8c434101a78d1c75c817711687fe1f636690e487 Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 07:08:01 2025 -0400 generate migrations against prod based on current dev schemas commit d6574ccd5132097fccbc7d0660e8ff727be70b7f Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 07:04:36 2025 -0400 pull schema from dev and updated schema.ts with cleaner code commit e82b571335a5563a895130acb3fa14d21269874f Author: David Bauch <jamesbauch@gmail.com> Date: Tue Jul 29 05:39:49 2025 -0400 pull schema from prod
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import { account, fileTag, pinnedFile, session, tag, user } from "./schema";
|
|
import { relations } from "drizzle-orm/relations";
|
|
|
|
// https://orm.drizzle.team/docs/relations
|
|
|
|
export const fileTagRelations = relations(fileTag, ({ one }) => ({
|
|
tag: one(tag, {
|
|
fields: [fileTag.tagId],
|
|
references: [tag.id],
|
|
}),
|
|
user: one(user, {
|
|
fields: [fileTag.userId],
|
|
references: [user.id],
|
|
}),
|
|
}));
|
|
|
|
export const tagRelations = relations(tag, ({ one, many }) => ({
|
|
fileTags: many(fileTag),
|
|
tag: one(tag, {
|
|
fields: [tag.parentId],
|
|
references: [tag.id],
|
|
relationName: "tag_parentId_tag_id",
|
|
}),
|
|
tags: many(tag, {
|
|
relationName: "tag_parentId_tag_id",
|
|
}),
|
|
user: one(user, {
|
|
fields: [tag.userId],
|
|
references: [user.id],
|
|
}),
|
|
}));
|
|
|
|
export const userRelations = relations(user, ({ many }) => ({
|
|
fileTags: many(fileTag),
|
|
accounts: many(account),
|
|
sessions: many(session),
|
|
tags: many(tag),
|
|
pinnedFiles: many(pinnedFile),
|
|
}));
|
|
|
|
export const accountRelations = relations(account, ({ one }) => ({
|
|
user: one(user, {
|
|
fields: [account.userId],
|
|
references: [user.id],
|
|
}),
|
|
}));
|
|
|
|
export const sessionRelations = relations(session, ({ one }) => ({
|
|
user: one(user, {
|
|
fields: [session.userId],
|
|
references: [user.id],
|
|
}),
|
|
}));
|
|
|
|
export const pinnedFileRelations = relations(pinnedFile, ({ one }) => ({
|
|
user: one(user, {
|
|
fields: [pinnedFile.userId],
|
|
references: [user.id],
|
|
}),
|
|
}));
|