ReferenceAsk
Remy Reference/agent/db.defineTable
?

db.defineTable

Declare a typed table. The TypeScript interface is the schema: add a field and the column exists on next deploy.
db.defineTable<T>(name, options?) Table<T>

Declares a typed table from a TypeScript interface, which is the schema. Add a field and the column appears on the next deploy; drop one and the column is removed. Declare unique constraints here (a db.upsert needs one to conflict against) and defaults for values filled in on insert. List only your own columns: id, created_at, updated_at, and last_updated_by are added and managed for you.

Parameters
name
string
RequiredTable name (snake_case, [a-zA-Z0-9_]).
options
object
unique constraints and defaults.
Define a table
import { db } from '@mindstudio-ai/agent';

interface Vendor { name: string; status: 'pending' | 'approved'; }
export const Vendors = db.defineTable<Vendor>('vendors', {
  unique: [['name']],
});