Skip to content

Commit

Permalink
jobs/postgres: support search_path for dev database (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Apr 29, 2024
1 parent 1153a76 commit cd8ff8f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
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

0 comments on commit cd8ff8f

Please sign in to comment.