#!/bin/sh
#-- COPYRIGHT 2007 Eugene Koontz <ekoontz@hiro-tan.org>
#-- This file is part of Psqlog : an 
#-- implementation of Prolog in PostgreSQL
#--
#-- Licenced under the GNU General Public License version 2 or higher.
#-- 
#--

#start from scratch..
dropdb -U www company 
createdb -U www company || exit

echo "CREATE LANGUAGE plpgsql" | psql -U www company

#load company's native schema
psql -U www company < company.sql

# A) create psqlog's views
xsltproc view2sql.xsl employee.xml | psql -U www company

# B) load psqlog's unify functionality:
psql -U www company < unify.plpgsql

#load domain-specific psqlog rules.
# this can only be done after both A) and B).
psql -U www company < company_rules.sql

#run test
time psql -U www company < test.sql


