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 | |
| 21 | export { ColumnBuilder } from './columns.js'; |
| 22 | export type { ColumnDef, OnDelete } from './columns.js'; |
| 23 | export { |
| 24 | bigint, |
| 25 | boolean, |
| 26 | integer, |
| 27 | jsonb, |
| 28 | text, |
| 29 | timestamp, |
| 30 | uuid, |
| 31 | varchar, |
| 32 | vector, |
| 33 | } from './columns.js'; |
| 34 | |
| 35 | export { table, isIdentifier } from './table.js'; |
| 36 | export type { AccessRules, IndexDef, TableDef, TableInput } from './table.js'; |
| 37 | |
| 38 | export { schema } from './schema.js'; |
| 39 | export type { SchemaDef } from './schema.js'; |
| 40 | |
| 41 | export { generateSql, renderCreateTable } from './sql.js'; |
| 42 | export { diff, summariseDiff } from './diff.js'; |
| 43 | export type { Change, DiffResult } from './diff.js'; |
| 44 | |
| 45 | export { schemaSnapshotSchema, validateSchemaSnapshot } from './wire.js'; |
| 46 | export type { SchemaSnapshotWire } from './wire.js'; |
| 47 | |
| 48 | export 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'; |