key.sql.ts 553 B

12345678910111213141516
  1. import { text, pgTable, varchar, uniqueIndex } from "drizzle-orm/pg-core"
  2. import { timestamps, utc, workspaceColumns } from "../drizzle/types"
  3. import { workspaceIndexes } from "./workspace.sql"
  4. export const KeyTable = pgTable(
  5. "key",
  6. {
  7. ...workspaceColumns,
  8. ...timestamps,
  9. userID: text("user_id").notNull(),
  10. name: varchar("name", { length: 255 }).notNull(),
  11. key: varchar("key", { length: 255 }).notNull(),
  12. timeUsed: utc("time_used"),
  13. },
  14. (table) => [...workspaceIndexes(table), uniqueIndex("global_key").on(table.key)],
  15. )