chore: starter template
This commit is contained in:
21
db/annotations.ts
Normal file
21
db/annotations.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
// Column annotations — compiled by `pikku db migrate` into db/annotations.gen.json,
|
||||
// which drives BOTH the generated types/zod AND runtime value coercion.
|
||||
//
|
||||
// Declare a `kind` for every semantic date/bool/json column you add:
|
||||
// - kind: 'date' → the column types as `Date` end-to-end. Write real `Date`
|
||||
// objects, read back `Date` objects; the TEXT storage is coerced both ways.
|
||||
// - kind: 'bool' → types as `boolean` over the INTEGER 0/1 storage.
|
||||
// - kind: 'json' → parsed/serialized automatically.
|
||||
// Without a kind, a SQLite date column is just `string` (write ISO strings via
|
||||
// `new Date().toISOString()`) and a flag is `number` — that default is fine too;
|
||||
// just follow the generated type, never fight it with `new Date()` writes or casts.
|
||||
//
|
||||
// Optional per column: security ('public' | 'private' | 'pii' | 'secret'),
|
||||
// classification (anonymize strategy), tsType, format, description.
|
||||
export const classifications = {
|
||||
// Example — after adding a `todos` table in a migration:
|
||||
// todos: {
|
||||
// created_at: { kind: 'date' },
|
||||
// done: { kind: 'bool' },
|
||||
// },
|
||||
}
|
||||
Reference in New Issue
Block a user