Model
Fields, constraints, relations.
import { model, text, boolean, belongsTo } from '@hopak/core';
export default model('post', {
title: text().required().min(3).max(200),
content: text().required(),
published: boolean().default(false),
author: belongsTo('user'),
}); The declaration creates the table columns, the TypeScript row type, and the validator.