key.sql.ts 602 B

1234567891011121314151617
  1. import { mysqlTable, varchar, uniqueIndex, json } from "drizzle-orm/mysql-core"
  2. import { timestamps, utc, workspaceColumns } from "../drizzle/types"
  3. import { workspaceIndexes } from "./workspace.sql"
  4. import { Actor } from "../actor"
  5. export const KeyTable = mysqlTable(
  6. "key",
  7. {
  8. ...workspaceColumns,
  9. ...timestamps,
  10. actor: json("actor").$type<Actor.Info>(),
  11. name: varchar("name", { length: 255 }).notNull(),
  12. key: varchar("key", { length: 255 }).notNull(),
  13. timeUsed: utc("time_used"),
  14. },
  15. (table) => [...workspaceIndexes(table), uniqueIndex("global_key").on(table.key)],
  16. )