Files
loki/scripts/site-template/lib/db/schema.ts
Catoandgithub-actions[bot] d7a882fbec chore(starter): sync scripts/site-template to bitbaum/fleet@5dc0be8081 (#1467)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-29 12:15:40 +01:00

24 lines
820 B
TypeScript

import { pgTable, text, timestamp } from "drizzle-orm/pg-core";
import { user } from "@bitbaum/accountkit/auth/schema";
export * from "@bitbaum/accountkit/auth/schema";
const timestamps = {
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
updatedAt: timestamp("updated_at", { withTimezone: true })
.defaultNow()
.$onUpdate(() => new Date())
.notNull(),
};
export const modelKey = pgTable("model_keys", {
userId: text("user_id")
.primaryKey()
.references(() => user.id, { onDelete: "cascade" }),
vendor: text("vendor").notNull(),
model: text("model").notNull(),
sealedKey: text("sealed_key").notNull(),
hint: text("hint").notNull(),
...timestamps,
});
export type User = typeof user.$inferSelect;
export type ModelKey = typeof modelKey.$inferSelect;