Skip to content

Commit 1d80875

Browse files
committed
[create-pull-request] automated change
1 parent 0773d1e commit 1d80875

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

database/migrations/relations.ts

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { relations } from "drizzle-orm/relations";
22
import {
33
neptunUser,
4-
chatConversation,
54
neptunUserOauthAccount,
65
chatConversationMessage,
6+
chatConversation,
77
chatConversationFile,
88
neptunUserFile,
99
githubAppInstallation,
@@ -21,25 +21,21 @@ import {
2121
chatConversationShareWhitelistEntry,
2222
} from "./schema.js";
2323

24-
export const chatConversationRelations = relations(
25-
chatConversation,
26-
({ one, many }) => ({
24+
export const neptunUserOauthAccountRelations = relations(
25+
neptunUserOauthAccount,
26+
({ one }) => ({
2727
neptunUser: one(neptunUser, {
28-
fields: [chatConversation.neptunUserId],
28+
fields: [neptunUserOauthAccount.neptunUserId],
2929
references: [neptunUser.id],
3030
}),
31-
chatConversationMessages: many(chatConversationMessage),
32-
chatConversationFiles: many(chatConversationFile),
33-
projectChatConversations: many(projectChatConversation),
34-
chatConversationShares: many(chatConversationShare),
3531
}),
3632
);
3733

3834
export const neptunUserRelations = relations(neptunUser, ({ many }) => ({
39-
chatConversations: many(chatConversation),
4035
neptunUserOauthAccounts: many(neptunUserOauthAccount),
4136
chatConversationMessages: many(chatConversationMessage),
4237
chatConversationFiles: many(chatConversationFile),
38+
chatConversations: many(chatConversation),
4339
githubAppInstallations: many(githubAppInstallation),
4440
neptunContextFiles: many(neptunContextFile),
4541
neptunContextImports: many(neptunContextImport),
@@ -52,16 +48,6 @@ export const neptunUserRelations = relations(neptunUser, ({ many }) => ({
5248
),
5349
}));
5450

55-
export const neptunUserOauthAccountRelations = relations(
56-
neptunUserOauthAccount,
57-
({ one }) => ({
58-
neptunUser: one(neptunUser, {
59-
fields: [neptunUserOauthAccount.neptunUserId],
60-
references: [neptunUser.id],
61-
}),
62-
}),
63-
);
64-
6551
export const chatConversationMessageRelations = relations(
6652
chatConversationMessage,
6753
({ one, many }) => ({
@@ -77,6 +63,20 @@ export const chatConversationMessageRelations = relations(
7763
}),
7864
);
7965

66+
export const chatConversationRelations = relations(
67+
chatConversation,
68+
({ one, many }) => ({
69+
chatConversationMessages: many(chatConversationMessage),
70+
chatConversationFiles: many(chatConversationFile),
71+
neptunUser: one(neptunUser, {
72+
fields: [chatConversation.neptunUserId],
73+
references: [neptunUser.id],
74+
}),
75+
projectChatConversations: many(projectChatConversation),
76+
chatConversationShares: many(chatConversationShare),
77+
}),
78+
);
79+
8080
export const chatConversationFileRelations = relations(
8181
chatConversationFile,
8282
({ one }) => ({
@@ -258,14 +258,14 @@ export const neptunUserTemplateRelations = relations(
258258
fields: [neptunUserTemplate.neptunUserId],
259259
references: [neptunUser.id],
260260
}),
261-
neptunUserTemplateCollection: one(neptunUserTemplateCollection, {
262-
fields: [neptunUserTemplate.templateCollectionId],
263-
references: [neptunUserTemplateCollection.id],
264-
}),
265261
neptunUserFile: one(neptunUserFile, {
266262
fields: [neptunUserTemplate.userFileId],
267263
references: [neptunUserFile.id],
268264
}),
265+
neptunUserTemplateCollection: one(neptunUserTemplateCollection, {
266+
fields: [neptunUserTemplate.templateCollectionId],
267+
references: [neptunUserTemplateCollection.id],
268+
}),
269269
}),
270270
);
271271

database/migrations/schema.ts

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
import {
22
pgTable,
3+
unique,
34
pgEnum,
45
serial,
56
text,
67
timestamp,
78
integer,
8-
unique,
99
boolean,
1010
jsonb,
1111
uuid,
1212
} from "drizzle-orm/pg-core";
1313

1414
export const aiModelEnum = pgEnum("ai_model_enum", [
15-
"OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
16-
"meta-llama/Meta-Llama-3-8B-Instruct",
17-
"mistralai/Mistral-7B-Instruct-v0.1",
1815
"qwen/Qwen2.5-72B-Instruct",
1916
"qwen/Qwen2.5-Coder-32B-Instruct",
2017
"deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
2118
"meta-llama/Llama-3.3-70B-Instruct",
2219
"mistralai/Mistral-Nemo-Instruct-2407",
2320
"mistralai/Mistral-7B-Instruct-v0.3",
24-
"google/gemma-2-27b-it",
2521
"microsoft/Phi-3-mini-4k-instruct",
22+
"google/gemma-2-27b-it",
2623
]);
2724
export const chatConversationMessageActorEnum = pgEnum(
2825
"chat_conversation_message_actor_enum",
@@ -69,17 +66,6 @@ export const projectType = pgEnum("project_type", [
6966
"web-app",
7067
]);
7168

72-
export const chatConversation = pgTable("chat_conversation", {
73-
id: serial("id").primaryKey().notNull(),
74-
name: text("name").notNull(),
75-
model: aiModelEnum("model").notNull(),
76-
createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
77-
updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow(),
78-
neptunUserId: integer("neptun_user_id")
79-
.notNull()
80-
.references(() => neptunUser.id, { onDelete: "cascade" }),
81-
});
82-
8369
export const neptunUser = pgTable(
8470
"neptun_user",
8571
{
@@ -142,6 +128,17 @@ export const chatConversationFile = pgTable("chat_conversation_file", {
142128
.references(() => neptunUserFile.id, { onDelete: "cascade" }),
143129
});
144130

131+
export const chatConversation = pgTable("chat_conversation", {
132+
id: serial("id").primaryKey().notNull(),
133+
name: text("name").notNull(),
134+
model: text("model").notNull(),
135+
createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
136+
updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow(),
137+
neptunUserId: integer("neptun_user_id")
138+
.notNull()
139+
.references(() => neptunUser.id, { onDelete: "cascade" }),
140+
});
141+
145142
export const githubAppInstallation = pgTable("github_app_installation", {
146143
id: serial("id").primaryKey().notNull(),
147144
githubAccountType: text("github_account_type").notNull(),
@@ -218,7 +215,6 @@ export const neptunContextImport = pgTable("neptun_context_import", {
218215
importStatus: text("import_status").default("pending").notNull(),
219216
errorMessage: text("error_message"),
220217
fileTree: jsonb("file_tree"),
221-
excludePatterns: text("exclude_patterns").array(),
222218
createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
223219
updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow(),
224220
neptunUserId: integer("neptun_user_id")

0 commit comments

Comments
 (0)