Switch to @vercel/kv
This commit is contained in:
parent
45d3a8d0ee
commit
fc79a708f4
20 changed files with 188 additions and 1079 deletions
|
|
@ -1,56 +0,0 @@
|
|||
import { sql } from "@vercel/postgres";
|
||||
import { json, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { drizzle } from "drizzle-orm/vercel-postgres";
|
||||
|
||||
// const connection = createPool({ connectionString: process.env.POSTGRES_URL });
|
||||
|
||||
export const chats = pgTable("chats", {
|
||||
id: text("id").notNull().primaryKey(),
|
||||
title: text("role").notNull(),
|
||||
userId: text("userId").notNull(),
|
||||
messages: json("messages").notNull().default({}),
|
||||
// .references(() => users.id),
|
||||
});
|
||||
|
||||
// export const messages = pgTable("messages", {
|
||||
// id: text("id").notNull().primaryKey(),
|
||||
// title: text("role").notNull(),
|
||||
// chatId: text("chatId")
|
||||
// .notNull()
|
||||
// .references(() => chats.id),
|
||||
// });
|
||||
|
||||
// export const chatsRelations = relations(chats, ({ many }) => ({
|
||||
// // user: one(users, {
|
||||
// // fields: [chats.userId],
|
||||
// // references: [users.id],
|
||||
// // }),
|
||||
// messages: many(messages),
|
||||
// }));
|
||||
|
||||
// export const messagesRelations = relations(messages, ({ one }) => ({
|
||||
// chat: one(chats, {
|
||||
// fields: [messages.chatId],
|
||||
// references: [chats.id],
|
||||
// }),
|
||||
// }));
|
||||
|
||||
export const db = drizzle(sql, {
|
||||
schema: {
|
||||
// users,
|
||||
// accounts,
|
||||
// sessions,
|
||||
// verificationTokens,
|
||||
chats,
|
||||
// chatsRelations,
|
||||
// messages,
|
||||
// messagesRelations,
|
||||
// usersRelations,
|
||||
},
|
||||
});
|
||||
|
||||
export type DbClient = typeof db;
|
||||
|
||||
export type Schema = {
|
||||
chats: typeof chats;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue