// Schema for the {{projectName}} row-history backend — a `documents` table whose // every change is snapshotted into row history (see app.config.ts). // `actors` + `tenants` are the framework core tables. import { databaseHandle, id, table, text, timestamp, type InferRow, } from '@voltro/database' import { tenant } from '@voltro/plugin-multitenancy' export const actors = table('actors', { id: id(), kind: text().oneOf(['user', 'serviceAccount', 'apiKey', 'system']), displayName: text().nullable(), createdAt: timestamp().default('now'), }) export const tenants = table('tenants', { id: id(), name: text(), createdAt: timestamp().default('now'), }) export const documents = table('documents', { id: id({ prefix: 'doc' }), title: text(), content: text(), }) .with(tenant()) export type Document = InferRow export const database = databaseHandle({ actors, tenants, documents })