import { pgTable, varchar, jsonb, timestamp, primaryKey } from "drizzle-orm/pg-core";

export const tinaKv = pgTable("tina_kv", {
  key: varchar("key", { length: 512 }).notNull(),
  value: jsonb("value").notNull(),
  namespace: varchar("namespace", { length: 100 }).notNull().default("main"),
  createdAt: timestamp("created_at", { withTimezone: true }).defaultNow(),
  updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow(),
}, (table) => ({
  pk: primaryKey({ columns: [table.key, table.namespace] }),
}));
