index.ts60 lines · main
1/**
2 * @briven/schema — schema DSL + SQL generation for briven projects.
3 *
4 * Users declare their project's Postgres schema with this package:
5 *
6 * import { schema, table, text, timestamp } from '@briven/schema';
7 *
8 * export default schema({
9 * notes: table({
10 * id: text().primaryKey(),
11 * body: text().notNull(),
12 * createdAt: timestamp().default('now()').notNull(),
13 * }),
14 * });
15 *
16 * `@briven/cli` bundles the user's schema module, calls `generateSql()`
17 * and `diff()` to plan a migration, and ships the result to
18 * `apps/api` / the shard worker for transactional application.
19 */
20
21export { ColumnBuilder } from './columns.js';
22export type { ColumnDef, OnDelete } from './columns.js';
23export {
24 bigint,
25 boolean,
26 integer,
27 jsonb,
28 text,
29 timestamp,
30 uuid,
31 varchar,
32 vector,
33} from './columns.js';
34
35export { table, isIdentifier } from './table.js';
36export type { AccessRules, IndexDef, TableDef, TableInput } from './table.js';
37
38export { schema } from './schema.js';
39export type { SchemaDef } from './schema.js';
40
41export { generateSql, renderCreateTable } from './sql.js';
42export { diff, summariseDiff } from './diff.js';
43export type { Change, DiffResult } from './diff.js';
44
45export { schemaSnapshotSchema, validateSchemaSnapshot } from './wire.js';
46export type { SchemaSnapshotWire } from './wire.js';
47
48export type {
49 VectorSearchInput,
50 VectorSearchQuery,
51 AuthContext,
52 Ctx,
53 DbClient,
54 DeleteQuery,
55 InsertQuery,
56 Logger,
57 SelectQuery,
58 TableQuery,
59 UpdateQuery,
60} from './ctx.js';