Skip to content

Commit e2a7b85

Browse files
fix: postgres not loading data.dump with psql, changed to pg_restore instead
1 parent 5280460 commit e2a7b85

File tree

1 file changed

+8
-7
lines changed
  • bootcamp/materials/1-dimensional-data-modeling/scripts

1 file changed

+8
-7
lines changed

bootcamp/materials/1-dimensional-data-modeling/scripts/init-db.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#!/bin/bash
22
set -e
33

4-
# Import the data dump
5-
psql \
6-
-v ON_ERROR_STOP=1 \
7-
--username $POSTGRES_USER \
8-
--dbname $POSTGRES_DB \
9-
< /docker-entrypoint-initdb.d/data.dump
10-
4+
# Restore the dump file using pg_restore
5+
pg_restore \
6+
-v \
7+
--no-owner \
8+
--no-privileges \
9+
-U $POSTGRES_USER \
10+
-d $POSTGRES_DB \
11+
/docker-entrypoint-initdb.d/data.dump
1112

1213
# Check if the path is a directory using the -d flag and
1314
# there are SQL files in the directory using the -f command

0 commit comments

Comments
 (0)