pact-foundation / pact_broker

Enables your consumer driven contracts workflow
http://pactflow.io
MIT License
707 stars 174 forks source link

Add Support for Specifying Database Schema via Environment Variable #726

Open somnath157 opened 5 months ago

somnath157 commented 5 months ago

I am trying to connect to an external database and have successfully done so by defining the PACT_BROKER_DATABASE_URL. However, the tables are being created under the public schema of the database. Since this database is used by multiple applications, I would like to have these tables under a specific schema for Pact Broker.

I couldn't find any way to achieve this using an environment variable. This seems like a common scenario and should ideally be controllable via an environment variable.

mefellows commented 5 months ago

The database URL can contain the schema you want to deploy it to, e.g.

postgres://user:pass@host:5432/dbname

Is this not what you need?

mefellows commented 5 months ago

Ah yes, schemas != databases.

mefellows commented 5 months ago

If the issue is logical separation, does multiple databases not solve the problem? I.e. the Pact Broker database should be separate to whatever else is on the postgres cluster. My understanding is that a schema is lower in the hierarchy than database. So it might be "public", but it's only public within the database itself.

somnath157 commented 5 months ago

New DB will solve the problem of separation from application DB. But still there should be a way to define schema under that DB.

YOU54F commented 1 month ago

moved to pact_broker repo, as the pact-broker-docker repo serves to only have additional code for dockerisation