ergonomics: .column should default to 0 | 1 unless nonNull: false - #84
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates typegres’s column-descriptor typing so Type.column() derives the returned instance’s nullability from { nonNull: true } (or lack thereof), eliminating the need to use TS generic instantiation expressions like (Text<1>).column(...) in user code and generated table code.
Changes:
- Teach
SqlValue.column()to return the type’s__nonNullablevs__nullablevariant based onopts.nonNull. - Add
__nullable/__nonNullablemetadata to the dialect rootAnyoverrides (PG + SQLite) so the newcolumn()typing works uniformly. - Update table codegen and tests/examples to emit and use
Type.column(...)instead of(Type<N>).column(...).
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/sqlite/overrides/any.ts | Adds __nullable / __nonNullable to SQLite root Any metadata. |
| src/types/sql-value.ts | Updates SqlValue.column() return type to derive nullability from opts.nonNull. |
| src/types/postgres/overrides/any.ts | Adds __nullable / __nonNullable to Postgres root Any metadata. |
| src/types/postgres/index.test.ts | Adjusts type-level column tests to use Type.column(...) directly. |
| src/tables/sqlite.test.ts | Updates generated SQLite table snapshots to the new column emission style. |
| src/tables/postgres.test.ts | Updates generated Postgres table snapshots to the new column emission style. |
| src/tables/generate.ts | Changes codegen to emit ${Type}.column(...) (drops <N> instantiation). |
| src/tables/generate.test.ts | Updates codegen tests’ expected output for the new column emission style. |
| src/table.test.ts | Updates inline table definitions to use Type.column(...). |
| src/scope.test.ts | Updates scope tests’ table definitions to use Type.column(...). |
| src/rpc-exoeval.test.ts | Updates RPC test table definitions to use Type.column(...). |
| src/rpc-capnweb.test.ts | Updates RPC test table definitions to use Type.column(...). |
| src/live/iteration.test.ts | Updates live-iteration test table definitions to use Type.column(...). |
| src/live/extractor.test.ts | Updates extractor tests’ table definitions to use Type.column(...). |
| src/live/events.test.ts | Updates live-events test table definitions to use Type.column(...). |
| src/live/db-live.test.ts | Updates db-live test table definitions to use Type.column(...). |
| src/hydrate.test.ts | Updates hydrate test table definitions to use Type.column(...). |
| src/demo/demo.ts | Updates demo table definition to use Type.column(...). |
| src/database.test.ts | Updates transaction tests’ table definitions to use Type.column(...). |
| src/builder/update.test.ts | Updates update-builder tests’ table definitions to use Type.column(...). |
| src/builder/query.test.ts | Updates query-builder tests’ table definitions to use Type.column(...). |
| src/builder/insert.test.ts | Updates insert-builder tests’ table definitions to use Type.column(...). |
| src/builder/delete.test.ts | Updates delete-builder tests’ table definitions to use Type.column(...). |
| examples/sqlite/src/tables/teams.ts | Updates SQLite example generated tables to use Type.column(...). |
| examples/sqlite/src/tables/dogs.ts | Updates SQLite example generated tables to use Type.column(...). |
| examples/basic/src/tables/toys.ts | Updates basic example generated tables to use Type.column(...). |
| examples/basic/src/tables/teams.ts | Updates basic example generated tables to use Type.column(...). |
| examples/basic/src/tables/microchips.ts | Updates basic example generated tables to use Type.column(...). |
| examples/basic/src/tables/dogs.ts | Updates basic example generated tables to use Type.column(...). |
| examples/basic/src/tables/collars.ts | Updates basic example generated tables to use Type.column(...). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ryanrasti
force-pushed
the
ryan_column_auto_null
branch
from
July 14, 2026 22:46
1b3f31c to
13d26ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.