Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(checkpoint-postgres): Add support for providing a custom schema during initialization #838

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

nick-w-nick
Copy link
Contributor

@nick-w-nick nick-w-nick commented Feb 2, 2025

This PR adds support for specifying a custom schema in the checkpoint-postgres module during initialization. Instead of relying on the default public schema used by Postgres or modifying the connection string’s search path (which can be unreliable at best), SQL queries now explicitly reference the provided schema, ensuring compatibility across all PostgreSQL versions and configurations, while still allowing the original module to stay backward compatible with previous versions since public was already the default schema.

// you can optionally pass a configuration object as the second parameter
const checkpointer = PostgresSaver.fromConnString("postgresql://...", {
  schema: "schema_name" // defaults to "public"
});

Key Changes

  • Custom Schema Support
    • Added an extendable options parameter to specify a schema when creating a PostgresSaver instance via the fromConnString method
    • Consolidated SQL queries and migration scripts into reusable functions that accept a schema name
  • Documentation & Testing
    • Improved JSDoc comments for fromConnString with usage example
    • Enhanced integration tests to validate behavior with both the default and a custom schema

… if a connection string env var is not found
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