Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Former-commit-id: ce17d85
  • Loading branch information
joncrlsn committed Oct 22, 2017
1 parent 765fb92 commit 6ba9ec7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
5 changes: 5 additions & 0 deletions test/add-schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

psql -U u1 -h localhost -d db1 >/dev/null <<EOS
$1
EOS

13 changes: 13 additions & 0 deletions test/start-fresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

sudo su - postgres -- <<EOT
psql <<'SQL'
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
DROP USER IF EXISTS u1;
CREATE USER u1 WITH SUPERUSER PASSWORD 'asdf';
CREATE DATABASE db1 WITH OWNER = u1 TEMPLATE = template1;
CREATE DATABASE db2 WITH OWNER = u1 TEMPLATE = template1;
SQL
EOT

27 changes: 15 additions & 12 deletions test/test-table.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
# Useful for visually inspecting the output SQL to verify it is doing what it should
#

sudo su - postgres -- <<EOT
psql <<'SQL'
DROP DATABASE IF EXISTS db1;
DROP DATABASE IF EXISTS db2;
DROP USER IF EXISTS u1;
CREATE USER u1 WITH SUPERUSER PASSWORD 'asdf';
CREATE DATABASE db1 WITH OWNER = u1 TEMPLATE = template1;
CREATE DATABASE db2 WITH OWNER = u1 TEMPLATE = template1;
SQL
EOT
source ./start-fresh.sh >/dev/null

#sudo su - postgres -- <<EOT
#psql <<'SQL'
# DROP DATABASE IF EXISTS db1;
# DROP DATABASE IF EXISTS db2;
# DROP USER IF EXISTS u1;
# CREATE USER u1 WITH SUPERUSER PASSWORD 'asdf';
# CREATE DATABASE db1 WITH OWNER = u1 TEMPLATE = template1;
# CREATE DATABASE db2 WITH OWNER = u1 TEMPLATE = template1;
#SQL
#EOT
export PGPASSWORD=asdf

echo
Expand All @@ -21,15 +23,16 @@ echo "# Compare the tables in two schemas in the same database"
#
# Compare the tables in two schemas in the same database
#
psql -U u1 -h localhost -d db1 <<'EOS'
#psql -U u1 -h localhost -d db1 <<'EOS'
./add-schema.sh "
CREATE SCHEMA s1;
CREATE TABLE s1.table9 (id integer); -- to be added to s2
CREATE TABLE s1.table10 (id integer);
CREATE SCHEMA s2;
CREATE TABLE s2.table10 (id integer);
CREATE TABLE s2.table11 (id integer); -- will be dropped from s2
EOS
"


echo
Expand Down

0 comments on commit 6ba9ec7

Please sign in to comment.