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

jobs/postgres: support search_path for dev database #6

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ workflows:
filters: *filters
working_directory: testdata
dir_name: my-cool-project
search_path: public
# The orb must be re-packed for publishing, and saved to the workspace.
- orb-tools/pack:
filters: *release-filters
Expand Down
39 changes: 30 additions & 9 deletions src/jobs/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ parameters:
type: string
default: "cimg/postgres:16.2"
description: 'The Docker image to use for the PostgreSQL database.'
search_path:
type: string
default: ""
description: |
The search path to use when running migrations. For example, `public`.
Set `search_path` to `public` to run migrations in the public schema (schema scope).
resource_class:
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge", "2xlarge", "2xlarge+"]
Expand All @@ -73,12 +79,27 @@ steps:
- setup:
version: <<parameters.atlas_version>>
cloud_token_env: <<parameters.cloud_token_env>>
- migrate_push:
working_directory: <<parameters.working_directory>>
dir_name: <<parameters.dir_name>>
dir: <<parameters.dir>>
tag: <<parameters.tag>>
config: <<parameters.config>>
env: <<parameters.env>>
vars: <<parameters.vars>>
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable
- when:
condition: <<parameters.search_path>>
steps:
- migrate_push:
working_directory: <<parameters.working_directory>>
dir_name: <<parameters.dir_name>>
dir: <<parameters.dir>>
tag: <<parameters.tag>>
config: <<parameters.config>>
env: <<parameters.env>>
vars: <<parameters.vars>>
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable&search_path=<<parameters.search_path>>
- unless:
condition: <<parameters.search_path>>
steps:
- migrate_push:
working_directory: <<parameters.working_directory>>
dir_name: <<parameters.dir_name>>
dir: <<parameters.dir>>
tag: <<parameters.tag>>
config: <<parameters.config>>
env: <<parameters.env>>
vars: <<parameters.vars>>
dev_url: postgres://postgres:pass@localhost:5432/postgres?sslmode=disable