Skip to content

Commit

Permalink
Add rule to import data from Heroku deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
jucor committed Feb 10, 2025
1 parent ef529fa commit 905abce
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,21 @@ sql: ## Connect to the database
@echo 'connecting to database: ${DATABASE_URL}'
docker compose ${COMPOSE_FILE_ARGS} --env-file ${ENV_FILE} run postgres psql ${DATABASE_URL}

replace-local-data-with-heroku: ## Import the data from Heroku. WILL ERASE LOCAL DATA.
## Assumes that you have set up heroku to connect to your polis prod instance
$(eval POSTGRES_USER = $(call parse_env_value,POSTGRES_USER))
$(eval POSTGRES_PASSWORD = $(call parse_env_value,POSTGRES_PASSWORD))
$(eval POSTGRES_PORT = $(call parse_env_value,POSTGRES_PORT))
$(eval POSTGRES_DB = $(call parse_env_value,POSTGRES_DB))
PGUSER=${POSTGRES_USER} PGPASSWORD=${POSTGRES_PASSWORD} dropdb --host localhost --port ${POSTGRES_PORT} --if-exists ${POSTGRES_DB} --interactive
PGUSER=${POSTGRES_USER} PGPASSWORD=${POSTGRES_PASSWORD} heroku pg:pull DATABASE_URL postgres://localhost:${POSTGRES_PORT}/${POSTGRES_DB} --app polisapp

%:
@true

.PHONY: help pull start stop rm-containers rm-volumes rm-images rm-ALL hash build-no-cache start-rebuild \
start-recreate restart-FULL-REBUILD e2e-install e2e-run e2e-run-all e2e-run-interactive \
build-web-assets extract-web-assets sql
build-web-assets extract-web-assets sql replace-local-data-with-heroku


help:
Expand Down

0 comments on commit 905abce

Please sign in to comment.