import { mysqlTable, varchar, text, integer, uniqueIndex } from "drizzle-orm/mysql-core"
import { timestamps, workspaceColumns } from "../drizzle/types"
import { workspaceIndexes } from "./workspace.sql"

export const ModelProviderPreferenceTable = mysqlTable(
  "model_provider_preference",
  {
    ...workspaceColumns,
    ...timestamps,
    model: varchar("model", { length: 128 }).notNull(),
    provider_preference: text("provider_preference").notNull(),
  },
  (table) => [...workspaceIndexes(table), uniqueIndex("model_provider_preference_workspace_model").on(table.workspaceID, table.model)],
)
