blog editor
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// https://orm.drizzle.team/docs/sql-schema-declaration
|
||||
|
||||
import { relations, sql } from "drizzle-orm";
|
||||
import { index, pgEnum, pgSchema, pgTableCreator } from "drizzle-orm/pg-core";
|
||||
import { index, pgEnum, pgSchema, pgTableCreator, uniqueIndex } from "drizzle-orm/pg-core";
|
||||
|
||||
/**
|
||||
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
|
||||
@@ -104,6 +104,33 @@ export const music = createTable(
|
||||
})
|
||||
)
|
||||
|
||||
export const blogPost = createTable(
|
||||
"blog_post",
|
||||
(d) => ({
|
||||
id: d.uuid().primaryKey().defaultRandom(),
|
||||
slug: d.varchar({ length: 200 }).notNull(),
|
||||
title: d.varchar({ length: 200 }).notNull(),
|
||||
date: d.varchar({ length: 20 }),
|
||||
description: d.text(),
|
||||
tags: d.text().array(),
|
||||
fileKey: d.varchar("file_key", { length: 200 }).notNull(),
|
||||
fileUrl: d.varchar("file_url", { length: 500 }).notNull(),
|
||||
fileName: d.varchar("file_name", { length: 255 }).notNull(),
|
||||
customId: d.varchar("custom_id", { length: 255 }).notNull(),
|
||||
createdAt: d
|
||||
.timestamp({ withTimezone: true })
|
||||
.default(sql`CURRENT_TIMESTAMP`)
|
||||
.notNull()
|
||||
.$type<Date>(),
|
||||
updatedAt: d.timestamp({ withTimezone: true }).$onUpdate(() => new Date()).$type<Date>(),
|
||||
}),
|
||||
(t) => [
|
||||
uniqueIndex("blog_post_slug_idx").on(t.slug),
|
||||
uniqueIndex("blog_post_file_key_idx").on(t.fileKey),
|
||||
uniqueIndex("blog_post_custom_id_idx").on(t.customId),
|
||||
],
|
||||
)
|
||||
|
||||
export const messageRoleEnum = pgEnum('message_role', ['user', 'assistant'])
|
||||
|
||||
export const chatSession = createTable(
|
||||
|
||||
Reference in New Issue
Block a user