#!/usr/bin/env bash

DB="timos_weird_example"
RESTORED_DB="timos_weird_example__restored"

# create a clean test environment
dropdb --if-exists $DB
dropdb --if-exists $RESTORED_DB
createdb $DB
createdb $RESTORED_DB

# apply schema
psql $DB < schema.sql

# then dump this schema
pg_dump $DB > dumped-schema.sql

# then restore this schema
psql $RESTORED_DB < dumped-schema.sql
