Skip to content

chore: Allow schema configuration#809

Open
maxforasteiro wants to merge 1 commit into
pact-foundation:masterfrom
maxforasteiro:chore/allow-schema-configuration
Open

chore: Allow schema configuration#809
maxforasteiro wants to merge 1 commit into
pact-foundation:masterfrom
maxforasteiro:chore/allow-schema-configuration

Conversation

@maxforasteiro

Copy link
Copy Markdown

Description

hey there, I made the changes with the help of AI™
I wasn't able to properly test it :D fixes #726

@YOU54F YOU54F requested review from JP-Ellis, YOU54F, impurist and pahnin July 2, 2025 17:01
@YOU54F

YOU54F commented Jul 2, 2025

Copy link
Copy Markdown
Member

Cheers for the change. Have added a few on for review, have you tested this out for your requirements?

Comment thread README.md
* Copy the [pact\_broker](https://github.com/DiUS/pact_broker-docker/tree/master/pact_broker) directory from the Pact Broker Docker project. This will have the recommended settings for database connections, logging, basic auth etc. Note that the Docker image uses Phusion Passenger as the web application server in front of the Pact Broker Ruby application, which is the recommended set up if you are not using a containerized solution.
* Modify the config.ru and Gemfile as desired (eg. choose database driver gem, set your database credentials. Use the "pg" gem for Postgres)
* example Sequel configuration for postgres `{ adapter: "postgres", database: "pact_broker", username: 'pact_broker', password: 'pact_broker', :encoding => 'utf8' }`
* If you need to use a custom PostgreSQL schema instead of the default `public` schema, add the `search_path` parameter: `{ adapter: "postgres", database: "pact_broker", username: 'pact_broker', password: 'pact_broker', :encoding => 'utf8', :search_path => 'my_custom_schema' }`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why search_path, and not schema here? same for other places it applies across the other files

Comment thread config/database.yml
postgres:
<<: *default
adapter: postgres
search_path: public

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we shouldn't need to explicitly specify here, if it defaults to public

database_port: nil,
database_url: nil,
database_sslmode: nil,
database_schema: "public", # Default to public schema

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

does a default value need to be provided here? If one isn't provided, surely it defaults to public to preserve existing behaviour. can this attr be set to nil?

@JP-Ellis

JP-Ellis commented Sep 5, 2025

Copy link
Copy Markdown
Member

It looks like this has gone stale...

@YOU54F, should we incorporate the changes manually so we can merge this? I'm not very familiar with this part of the codebase.

@YOU54F

YOU54F commented Oct 9, 2025

Copy link
Copy Markdown
Member

It looks like this has gone stale...

@YOU54F, should we incorporate the changes manually so we can merge this? I'm not very familiar with this part of the codebase.

Yeah I can try and pick this up.

I would probably just test manually, and ensure it retains the existing behaviour, whilst allowing others to setup a database with a specified schema.

it may be that in a future 3.x release, we default to a named schema for new databases and users opt in to public, if recommendations against using the public schema is now the default in latest versions of pg

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.

Add Support for Specifying Database Schema via Environment Variable

3 participants