You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

26 lines
950 B

import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
export const users = sqliteTable("users", {
id: integer().primaryKey(),
username: text().notNull().unique(),
email: text(),
nickname: text(),
password: text().notNull(),
avatar: text(),
role: text().notNull().default("user"),
status: text().notNull().default("active"),
createdAt: integer("created_at", { mode: "timestamp_ms" }).defaultNow().notNull(),
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
.defaultNow()
.$onUpdate(() => new Date())
.notNull(),
});
export const captchaCodes = sqliteTable("captcha_codes", {
id: integer().primaryKey(),
token: text().notNull().unique(),
code: text().notNull(),
expiresAt: integer("expires_at", { mode: "timestamp_ms" }).notNull(),
used: integer({ mode: "boolean" }).notNull().default(false),
createdAt: integer("created_at", { mode: "timestamp_ms" }).defaultNow().notNull(),
});