init: 个人简历项目文件
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import {
|
||||
mysqlTable,
|
||||
mysqlEnum,
|
||||
serial,
|
||||
varchar,
|
||||
text,
|
||||
timestamp,
|
||||
// bigint,
|
||||
} from "drizzle-orm/mysql-core";
|
||||
|
||||
export const users = mysqlTable("users", {
|
||||
id: serial("id").primaryKey(),
|
||||
unionId: varchar("unionId", { length: 255 }).notNull().unique(),
|
||||
name: varchar("name", { length: 255 }),
|
||||
email: varchar("email", { length: 320 }),
|
||||
avatar: text("avatar"),
|
||||
role: mysqlEnum("role", ["user", "admin"]).default("user").notNull(),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updatedAt")
|
||||
.defaultNow()
|
||||
.notNull()
|
||||
.$onUpdate(() => new Date()),
|
||||
lastSignInAt: timestamp("lastSignInAt").defaultNow().notNull(),
|
||||
});
|
||||
|
||||
export type User = typeof users.$inferSelect;
|
||||
export type InsertUser = typeof users.$inferInsert;
|
||||
|
||||
export const documents = mysqlTable("documents", {
|
||||
id: serial("id").primaryKey(),
|
||||
title: varchar("title", { length: 255 }).notNull(),
|
||||
slug: varchar("slug", { length: 255 }).notNull().unique(),
|
||||
excerpt: text("excerpt"),
|
||||
content: text("content").notNull(),
|
||||
coverImage: text("coverImage"),
|
||||
tags: text("tags"),
|
||||
published: mysqlEnum("published", ["draft", "published"]).default("published").notNull(),
|
||||
createdAt: timestamp("createdAt").defaultNow().notNull(),
|
||||
updatedAt: timestamp("updatedAt")
|
||||
.defaultNow()
|
||||
.notNull()
|
||||
.$onUpdate(() => new Date()),
|
||||
});
|
||||
|
||||
export type Document = typeof documents.$inferSelect;
|
||||
export type InsertDocument = typeof documents.$inferInsert;
|
||||
Reference in New Issue
Block a user