Revert "Upgrade linter and formatter to Ultracite" (#1226)
This commit is contained in:
parent
0e320b391d
commit
1aff7d9868
177 changed files with 8334 additions and 6943 deletions
140
lib/db/schema.ts
140
lib/db/schema.ts
|
|
@ -1,64 +1,64 @@
|
|||
import type { InferSelectModel } from "drizzle-orm";
|
||||
import type { InferSelectModel } from 'drizzle-orm';
|
||||
import {
|
||||
boolean,
|
||||
foreignKey,
|
||||
pgTable,
|
||||
varchar,
|
||||
timestamp,
|
||||
json,
|
||||
jsonb,
|
||||
pgTable,
|
||||
primaryKey,
|
||||
text,
|
||||
timestamp,
|
||||
uuid,
|
||||
varchar,
|
||||
} from "drizzle-orm/pg-core";
|
||||
import type { AppUsage } from "../usage";
|
||||
text,
|
||||
primaryKey,
|
||||
foreignKey,
|
||||
boolean,
|
||||
} from 'drizzle-orm/pg-core';
|
||||
import type { AppUsage } from '../usage';
|
||||
|
||||
export const user = pgTable("User", {
|
||||
id: uuid("id").primaryKey().notNull().defaultRandom(),
|
||||
email: varchar("email", { length: 64 }).notNull(),
|
||||
password: varchar("password", { length: 64 }),
|
||||
export const user = pgTable('User', {
|
||||
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
||||
email: varchar('email', { length: 64 }).notNull(),
|
||||
password: varchar('password', { length: 64 }),
|
||||
});
|
||||
|
||||
export type User = InferSelectModel<typeof user>;
|
||||
|
||||
export const chat = pgTable("Chat", {
|
||||
id: uuid("id").primaryKey().notNull().defaultRandom(),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
title: text("title").notNull(),
|
||||
userId: uuid("userId")
|
||||
export const chat = pgTable('Chat', {
|
||||
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
title: text('title').notNull(),
|
||||
userId: uuid('userId')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
visibility: varchar("visibility", { enum: ["public", "private"] })
|
||||
visibility: varchar('visibility', { enum: ['public', 'private'] })
|
||||
.notNull()
|
||||
.default("private"),
|
||||
lastContext: jsonb("lastContext").$type<AppUsage | null>(),
|
||||
.default('private'),
|
||||
lastContext: jsonb('lastContext').$type<AppUsage | null>(),
|
||||
});
|
||||
|
||||
export type Chat = InferSelectModel<typeof chat>;
|
||||
|
||||
// DEPRECATED: The following schema is deprecated and will be removed in the future.
|
||||
// Read the migration guide at https://chat-sdk.dev/docs/migration-guides/message-parts
|
||||
export const messageDeprecated = pgTable("Message", {
|
||||
id: uuid("id").primaryKey().notNull().defaultRandom(),
|
||||
chatId: uuid("chatId")
|
||||
export const messageDeprecated = pgTable('Message', {
|
||||
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
||||
chatId: uuid('chatId')
|
||||
.notNull()
|
||||
.references(() => chat.id),
|
||||
role: varchar("role").notNull(),
|
||||
content: json("content").notNull(),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
role: varchar('role').notNull(),
|
||||
content: json('content').notNull(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
});
|
||||
|
||||
export type MessageDeprecated = InferSelectModel<typeof messageDeprecated>;
|
||||
|
||||
export const message = pgTable("Message_v2", {
|
||||
id: uuid("id").primaryKey().notNull().defaultRandom(),
|
||||
chatId: uuid("chatId")
|
||||
export const message = pgTable('Message_v2', {
|
||||
id: uuid('id').primaryKey().notNull().defaultRandom(),
|
||||
chatId: uuid('chatId')
|
||||
.notNull()
|
||||
.references(() => chat.id),
|
||||
role: varchar("role").notNull(),
|
||||
parts: json("parts").notNull(),
|
||||
attachments: json("attachments").notNull(),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
role: varchar('role').notNull(),
|
||||
parts: json('parts').notNull(),
|
||||
attachments: json('attachments').notNull(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
});
|
||||
|
||||
export type DBMessage = InferSelectModel<typeof message>;
|
||||
|
|
@ -66,56 +66,56 @@ export type DBMessage = InferSelectModel<typeof message>;
|
|||
// DEPRECATED: The following schema is deprecated and will be removed in the future.
|
||||
// Read the migration guide at https://chat-sdk.dev/docs/migration-guides/message-parts
|
||||
export const voteDeprecated = pgTable(
|
||||
"Vote",
|
||||
'Vote',
|
||||
{
|
||||
chatId: uuid("chatId")
|
||||
chatId: uuid('chatId')
|
||||
.notNull()
|
||||
.references(() => chat.id),
|
||||
messageId: uuid("messageId")
|
||||
messageId: uuid('messageId')
|
||||
.notNull()
|
||||
.references(() => messageDeprecated.id),
|
||||
isUpvoted: boolean("isUpvoted").notNull(),
|
||||
isUpvoted: boolean('isUpvoted').notNull(),
|
||||
},
|
||||
(table) => {
|
||||
return {
|
||||
pk: primaryKey({ columns: [table.chatId, table.messageId] }),
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export type VoteDeprecated = InferSelectModel<typeof voteDeprecated>;
|
||||
|
||||
export const vote = pgTable(
|
||||
"Vote_v2",
|
||||
'Vote_v2',
|
||||
{
|
||||
chatId: uuid("chatId")
|
||||
chatId: uuid('chatId')
|
||||
.notNull()
|
||||
.references(() => chat.id),
|
||||
messageId: uuid("messageId")
|
||||
messageId: uuid('messageId')
|
||||
.notNull()
|
||||
.references(() => message.id),
|
||||
isUpvoted: boolean("isUpvoted").notNull(),
|
||||
isUpvoted: boolean('isUpvoted').notNull(),
|
||||
},
|
||||
(table) => {
|
||||
return {
|
||||
pk: primaryKey({ columns: [table.chatId, table.messageId] }),
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export type Vote = InferSelectModel<typeof vote>;
|
||||
|
||||
export const document = pgTable(
|
||||
"Document",
|
||||
'Document',
|
||||
{
|
||||
id: uuid("id").notNull().defaultRandom(),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
title: text("title").notNull(),
|
||||
content: text("content"),
|
||||
kind: varchar("text", { enum: ["text", "code", "image", "sheet"] })
|
||||
id: uuid('id').notNull().defaultRandom(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
title: text('title').notNull(),
|
||||
content: text('content'),
|
||||
kind: varchar('text', { enum: ['text', 'code', 'image', 'sheet'] })
|
||||
.notNull()
|
||||
.default("text"),
|
||||
userId: uuid("userId")
|
||||
.default('text'),
|
||||
userId: uuid('userId')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
},
|
||||
|
|
@ -123,25 +123,25 @@ export const document = pgTable(
|
|||
return {
|
||||
pk: primaryKey({ columns: [table.id, table.createdAt] }),
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
export type Document = InferSelectModel<typeof document>;
|
||||
|
||||
export const suggestion = pgTable(
|
||||
"Suggestion",
|
||||
'Suggestion',
|
||||
{
|
||||
id: uuid("id").notNull().defaultRandom(),
|
||||
documentId: uuid("documentId").notNull(),
|
||||
documentCreatedAt: timestamp("documentCreatedAt").notNull(),
|
||||
originalText: text("originalText").notNull(),
|
||||
suggestedText: text("suggestedText").notNull(),
|
||||
description: text("description"),
|
||||
isResolved: boolean("isResolved").notNull().default(false),
|
||||
userId: uuid("userId")
|
||||
id: uuid('id').notNull().defaultRandom(),
|
||||
documentId: uuid('documentId').notNull(),
|
||||
documentCreatedAt: timestamp('documentCreatedAt').notNull(),
|
||||
originalText: text('originalText').notNull(),
|
||||
suggestedText: text('suggestedText').notNull(),
|
||||
description: text('description'),
|
||||
isResolved: boolean('isResolved').notNull().default(false),
|
||||
userId: uuid('userId')
|
||||
.notNull()
|
||||
.references(() => user.id),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
},
|
||||
(table) => ({
|
||||
pk: primaryKey({ columns: [table.id] }),
|
||||
|
|
@ -149,17 +149,17 @@ export const suggestion = pgTable(
|
|||
columns: [table.documentId, table.documentCreatedAt],
|
||||
foreignColumns: [document.id, document.createdAt],
|
||||
}),
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
export type Suggestion = InferSelectModel<typeof suggestion>;
|
||||
|
||||
export const stream = pgTable(
|
||||
"Stream",
|
||||
'Stream',
|
||||
{
|
||||
id: uuid("id").notNull().defaultRandom(),
|
||||
chatId: uuid("chatId").notNull(),
|
||||
createdAt: timestamp("createdAt").notNull(),
|
||||
id: uuid('id').notNull().defaultRandom(),
|
||||
chatId: uuid('chatId').notNull(),
|
||||
createdAt: timestamp('createdAt').notNull(),
|
||||
},
|
||||
(table) => ({
|
||||
pk: primaryKey({ columns: [table.id] }),
|
||||
|
|
@ -167,7 +167,7 @@ export const stream = pgTable(
|
|||
columns: [table.chatId],
|
||||
foreignColumns: [chat.id],
|
||||
}),
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
export type Stream = InferSelectModel<typeof stream>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue