Skip to content

test: cover enum and array schemas and migrated-schema execution - #48

Merged
omer-cengel merged 2 commits into
masterfrom
chore/migration-directory-and-enum-array-schema-tests
Sep 28, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
chore/migration-directory-and-enum-array-schema-tests

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Adds acceptance tests showing that PostgreSQL schemas shaped like published sqlc examples load as documented, and that a migration directory runs end to end: PostgreSQL applies the files, and code generated from the same directory executes against the migrated tables.

Changes

  • Schema-parser test: a single-file schema with an enum type, an enum column, a varchar[] column, indexes, and a dollar-quoted function followed by another statement loads, with the enum and array columns recorded as unsupported types.
  • Schema-parser test: a migration file containing COMMENT ON TYPE fails on that statement with a located syntax diagnostic (Encountered unexpected token: "TYPE" at line 14, column 12).
  • Schema-parser test: without that statement, the migration files applied in order ignore the COMMENT ON TABLE/COLUMN statements and the enum type, rename a table, drop one column and add another, and record the enum, enum-array, and text[] columns as unsupported.
  • PostgreSQL integration test: migration files written to a temporary directory are applied in file-name order, and a repository generated and compiled from that directory creates and reads rows through the renamed table and its added column.
  • The PostgreSQL test helper can now generate from a schema directory as well as a single schema file, and database reset drops the new fixture tables and enum type.

Scope and non-goals

  • Test-only change: no compiler, runtime, configuration, or documentation behavior changes.
  • Fixtures are original SQL; no third-party example files are added to the repository.
  • Enum and array types stay unsupported, and COMMENT ON TYPE stays a syntax error; sqlcj does not pre-process SQL to skip it.

@omer-cengel
omer-cengel merged commit 7ed5547 into master Sep 28, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the chore/migration-directory-and-enum-array-schema-tests branch September 28, 2026 16:04
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.

1 participant