forked from JannikArndt/PostgreSQLSampleDatabase
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrestore.sh
More file actions
executable file
·16 lines (13 loc) · 804 Bytes
/
restore.sh
File metadata and controls
executable file
·16 lines (13 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env bash
DATABASENAME=${1:-'mywebshop'}
echo "Restoring data to database $DATABASENAME"
createdb $DATABASENAME
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/create.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/products.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/articles.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/labels.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/customer.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/address.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/order.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/order_positions.sql
psql -h localhost -p 5432 -U postgres -d $DATABASENAME -f data/stock.sql