Restored to '7aa09373aacdcc1083018c718e608e30b6be2b33'
Replit-Restored-To: 7aa09373aa
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
import { pgTable, serial, integer, text, timestamp } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { z } from "zod";
|
||||
import { sql } from "drizzle-orm";
|
||||
|
||||
export const conversations = pgTable("conversations", {
|
||||
id: serial("id").primaryKey(),
|
||||
title: text("title").notNull(),
|
||||
createdAt: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
||||
});
|
||||
|
||||
export const messages = pgTable("messages", {
|
||||
id: serial("id").primaryKey(),
|
||||
conversationId: integer("conversation_id").notNull().references(() => conversations.id, { onDelete: "cascade" }),
|
||||
role: text("role").notNull(),
|
||||
content: text("content").notNull(),
|
||||
createdAt: timestamp("created_at").default(sql`CURRENT_TIMESTAMP`).notNull(),
|
||||
});
|
||||
|
||||
export const insertConversationSchema = createInsertSchema(conversations).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
|
||||
export const insertMessageSchema = createInsertSchema(messages).omit({
|
||||
id: true,
|
||||
createdAt: true,
|
||||
});
|
||||
|
||||
export type Conversation = typeof conversations.$inferSelect;
|
||||
export type InsertConversation = z.infer<typeof insertConversationSchema>;
|
||||
export type Message = typeof messages.$inferSelect;
|
||||
export type InsertMessage = z.infer<typeof insertMessageSchema>;
|
||||
|
||||
@@ -26,23 +26,6 @@ export const insertArticleSchema = createInsertSchema(articles).omit({
|
||||
export type InsertArticle = z.infer<typeof insertArticleSchema>;
|
||||
export type Article = typeof articles.$inferSelect;
|
||||
|
||||
export const dailyHoroscopes = pgTable("daily_horoscopes", {
|
||||
id: serial("id").primaryKey(),
|
||||
signIndex: integer("sign_index").notNull(),
|
||||
signName: varchar("sign_name", { length: 50 }).notNull(),
|
||||
dateStr: varchar("date_str", { length: 10 }).notNull(),
|
||||
general: text("general").notNull(),
|
||||
love: text("love").notNull(),
|
||||
career: text("career").notNull(),
|
||||
health: text("health").notNull(),
|
||||
tip: text("tip").notNull(),
|
||||
weekly: text("weekly").notNull(),
|
||||
monthly: text("monthly").notNull(),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
});
|
||||
|
||||
export type DailyHoroscope = typeof dailyHoroscopes.$inferSelect;
|
||||
|
||||
export const users = pgTable("users", {
|
||||
id: varchar("id").primaryKey().default(sql`gen_random_uuid()`),
|
||||
username: text("username").notNull().unique(),
|
||||
|
||||
Reference in New Issue
Block a user