#!/bin/sh

set -eux

WORKDIR=$PWD/debian/home

pg_virtualenv << EOF
  set -eux
  createdb src
  createdb dst
  psql -c 'create table foo as select 123+456' src
  rm -rf $WORKDIR
  HOME=$WORKDIR pgcopydb clone --source "dbname=src" --target "dbname=dst" --dir $WORKDIR
  pg_dump -t foo dst
  pg_dump -t foo dst | grep 579
EOF
