Spaces:
Paused
Paused
| import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core"; | |
| export const user = sqliteTable("user", { | |
| id: text("id").primaryKey(), | |
| username: text("username").notNull().unique(), | |
| hashedPassword: text("hashed_password").notNull(), | |
| createdAt: integer("created_at").notNull(), | |
| }); | |
| export const session = sqliteTable("session", { | |
| id: text("id").primaryKey(), | |
| userId: text("user_id") | |
| .notNull() | |
| .references(() => user.id), | |
| expiresAt: integer("expires_at").notNull(), | |
| }); | |
| export const uptimeMonitor = sqliteTable("uptime_monitor", { | |
| id: text("id").primaryKey(), | |
| userId: text("user_id") | |
| .notNull() | |
| .references(() => user.id), | |
| url: text("url").notNull(), | |
| name: text("name").notNull(), | |
| interval: integer("interval").notNull().default(30), // seconds | |
| createdAt: integer("created_at").notNull(), | |
| }); | |
| export const uptimeCheck = sqliteTable("uptime_check", { | |
| id: text("id").primaryKey(), | |
| monitorId: text("monitor_id") | |
| .notNull() | |
| .references(() => uptimeMonitor.id), | |
| status: text("status", { enum: ["up", "down"] }).notNull(), | |
| statusCode: integer("status_code"), | |
| responseTime: integer("response_time"), | |
| error: text("error"), | |
| timestamp: integer("timestamp").notNull(), | |
| }); | |