Skip to content

Conversation

@ryanrasti
Copy link
Owner

No description provided.

@ryanrasti ryanrasti requested a review from Copilot October 28, 2025 22:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors the table schema definition system to support required/optional columns based on database defaults and auto-generated values. The main changes eliminate the need to manually specify column lists in INSERT statements by inferring them from the values being inserted.

  • Introduced a new TableSchema type that includes required metadata for each column
  • Updated insert() to automatically infer columns from values instead of requiring explicit columns parameter
  • Modified code generation to introspect has_default and is_generated flags from PostgreSQL

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/grammar/insert.ts Removed columns parameter from insert function; added TableSchemaToRowLikeStrict type to make columns with defaults optional
src/query/db.ts Refactored TableSchema to include required field; split into RowSchema and TableSchema types
src/cli/main.ts Updated introspection query to fetch has_default and is_generated flags; modified code generation
src/query/from-item.ts Updated references from TableSchema to RowSchema for simpler use cases
src/grammar/select.ts Refactored inline type to named SelectOpts type; updated Table type reference to include schema parameter
src/grammar/with.ts Updated Insert type reference to include new schema parameter
Multiple test files Removed columns parameter from all insert calls; reorganized imports alphabetically

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

tableClause: {
into: Types.Table<I>;
columns?: K[];
// we omit `columns` here becase we can always infer them from the `values` parameter
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'becase' to 'because'.

Suggested change
// we omit `columns` here becase we can always infer them from the `values` parameter
// we omit `columns` here because we can always infer them from the `values` parameter

Copilot uses AI. Check for mistakes.
for?: [
"update" | "noKeyUpdate" | "share" | "keyShare",
{
of?: [Types.Table<any, any>, ...Types.Table<any, any>[]];
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The of field in the for clause now requires two type parameters (Types.Table<any, any>), but this should use the full three parameters to match the updated Table type signature (Table<R, S, E>). Consider using Types.Table<any, any, any> for consistency.

Suggested change
of?: [Types.Table<any, any>, ...Types.Table<any, any>[]];
of?: [Types.Table<any, any, any>, ...Types.Table<any, any, any>[]];

Copilot uses AI. Check for mistakes.
@ryanrasti ryanrasti merged commit 866170f into main Oct 28, 2025
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants