// Schema for the {{projectName}} moderation backend — `posts` (block rule) and // `comments` (flag rule). `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 posts = table('posts', { id: id({ prefix: 'post' }), title: text(), body: text(), }) .with(tenant()) export const comments = table('comments', { id: id({ prefix: 'cmt' }), body: text(), }) .with(tenant()) export type Post = InferRow export type Comment = InferRow export const database = databaseHandle({ actors, tenants, posts, comments })