2021-09-06 00:43:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-10-23 22:28:06 +00:00
|
|
|
set -euxo pipefail
|
2021-09-06 00:43:49 +00:00
|
|
|
|
|
|
|
# This script is for use in local development only. It wipes the existing db,
|
|
|
|
# creates a new empty one, runs the initial migration to create the schema,
|
|
|
|
# and then imports actual db content on top of that.
|
|
|
|
|
|
|
|
# TODO(opensource): We should adapt Asaf's seedfile command and then delete this.
|
|
|
|
|
|
|
|
THIS_PATH=$(pwd)
|
2021-10-23 22:28:06 +00:00
|
|
|
#BETA_PATH='/mnt/c/Users/bvisn/Developer/handmade/handmade-beta'
|
|
|
|
BETA_PATH='/Users/benvisness/Developer/handmade/handmade-beta'
|
2021-09-06 00:43:49 +00:00
|
|
|
|
|
|
|
pushd $BETA_PATH
|
|
|
|
docker-compose down -v
|
|
|
|
docker-compose up -d postgres s3
|
|
|
|
sleep 3
|
|
|
|
|
|
|
|
docker-compose exec postgres bash -c "psql -U postgres -c \"CREATE ROLE hmn CREATEDB LOGIN PASSWORD 'password';\""
|
|
|
|
popd
|
2021-10-23 22:28:06 +00:00
|
|
|
go run src/main.go seedfile local/backups/hmn_pg_dump_live_2021-10-23
|