Added Setup script for a dev database

Script drops the current database 'test_artnet' if present.
It then creates a new one and uses the test data script.
master
Peery 3 years ago
parent 7734ad9deb
commit f9c8f9e7c9

@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS Presence (
CREATE TABLE IF NOT EXISTS Art_Collection ( -- for ordered lists of art
ID INTEGER PRIMARY KEY generated always as identity,
name VARCHAR,
name VARCHAR NOT NULL UNIQUE,
description VARCHAR
);

@ -0,0 +1,12 @@
#!/bin/sh
SCHEMA_CREATION_SCRIPT=./Create_DB.sql
TEST_DATA_SCRIPT=./Test_Data.sql
sudo psql -U postgres -c "DROP DATABASE test_artnet"
set -e
sudo psql -U postgres -c "CREATE DATABASE test_artnet WITH OWNER 'artnet_admin'"
sudo psql -U postgres test_artnet < $SCHEMA_CREATION_SCRIPT
sudo psql -U artnet_editor test_artnet < $TEST_DATA_SCRIPT
Loading…
Cancel
Save