Skip to content

Commit

Permalink
fix postgres Justfile commands (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas authored Jun 4, 2024
1 parent a7c0086 commit 00988b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed

- Updated `README.md` to account for recent changes to `Justfile` commands.
- In `.just/postgres.just`, added replacement in database URLs of `postgis://` to `postgres://` to account for potential PostGIS usage. When using the commands directly with the `db` container, there is no need for the PostGIS scheme.

### Removed

- Removed GitHub branching strategy section from `README.md`. This has been moved to our central Web Dev documentation.

### Fixed

- Fixed `just pg dump-prod` command subcall of `just pg dump` command.

## [2024.26]

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/django_twc_project/.just/postgres.just
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ default:
fmt:
@just --fmt --justfile {{ justfile }}

DATABASE_URL := env_var("DATABASE_URL")
DATABASE_URL := replace(env_var("DATABASE_URL"), "postgis://", "postgres://")

# Dump our local database to file
dump database_url=DATABASE_URL file='db.dump':
Expand All @@ -21,8 +21,8 @@ dump database_url=DATABASE_URL file='db.dump':

# Dump our production database to file
dump-prod file='production.dump':
set PROD_DATABASE_URL := "{{ env_var('PROD_DATABASE_URL') }}"
@just pg_dump ${PROD_DATABASE_URL} {{ file }}
set PROD_DATABASE_URL := '{{ replace(env_var("PROD_DATABASE_URL"), "postgis://", "postgres://") }}'
@just pg dump $PROD_DATABASE_URL {{ file }}

# Restore database backup to our local database
restore database_url=DATABASE_URL file='db.dump':
Expand Down

0 comments on commit 00988b6

Please sign in to comment.