Index: /waeup_z2sql/trunk/README.txt
===================================================================
--- /waeup_z2sql/trunk/README.txt	(revision 61)
+++ /waeup_z2sql/trunk/README.txt	(revision 61)
@@ -0,0 +1,29 @@
+
+To install this software, manually adapt the schema to your needs
+(esp.: change the usernames contained therein), and create a
+database. The pre-configured database name is "waeup". Then
+import the schema:
+
+$ psql waeup < waeup-schema.sql
+
+If you get errors, you may need some prerequisites, like eg PL-SQL.
+
+
+After that, get a Zope instance, preferably 2.8.2 (I only tested with that),
+and import the .zexp file.
+
+To use the software, point your browser to the folder created by the import
+(named "demo").
+
+Please note that this is less than alpha quality software.
+
+Suggestions on how to improve this software is very welcome, as well as useful
+patches, although I can promise you nothing.
+
+
+(c) 2005 Oeko.neT, software available under the GPLv2, or via private
+arrangement(s).
+
+
+2005-10-20, Toni Mueller, support@oeko.net
+
Index: /waeup_z2sql/trunk/waeup-schema.sql
===================================================================
--- /waeup_z2sql/trunk/waeup-schema.sql	(revision 61)
+++ /waeup_z2sql/trunk/waeup-schema.sql	(revision 61)
@@ -0,0 +1,877 @@
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'UNICODE';
+SET check_function_bodies = false;
+
+SET SESSION AUTHORIZATION 'postgres';
+
+SET search_path = public, pg_catalog;
+
+--
+-- TOC entry 34 (OID 31835)
+-- Name: plpgsql_call_handler(); Type: FUNC PROCEDURAL LANGUAGE; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler
+    AS '/usr/lib/postgresql/lib/plpgsql.so', 'plpgsql_call_handler'
+    LANGUAGE c;
+
+
+SET SESSION AUTHORIZATION DEFAULT;
+
+--
+-- TOC entry 33 (OID 31836)
+-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: public; Owner: 
+--
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;
+
+
+SET SESSION AUTHORIZATION 'postgres';
+
+--
+-- TOC entry 4 (OID 2200)
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+GRANT ALL ON SCHEMA public TO imke;
+GRANT CREATE ON SCHEMA public TO "109";
+
+
+SET SESSION AUTHORIZATION 'postgres';
+
+--
+-- TOC entry 35 (OID 74293)
+-- Name: char(integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "char"(integer) RETURNS text
+    AS '
+    SELECT chr($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 36 (OID 74294)
+-- Name: concat(text, text); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION concat(text, text) RETURNS text
+    AS '
+    SELECT $1 || $2;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 37 (OID 74295)
+-- Name: insert(text, integer, integer, text); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "insert"(text, integer, integer, text) RETURNS text
+    AS '
+    SELECT substring($1 from 1 for $2 - 1) || $4 || substring($1 from $2 + $3);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 38 (OID 74296)
+-- Name: lcase(text); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION lcase(text) RETURNS text
+    AS '
+    SELECT lower($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 39 (OID 74297)
+-- Name: left(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "left"(text, integer) RETURNS text
+    AS '
+    SELECT substring($1 for $2);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 40 (OID 74298)
+-- Name: locate(text, text); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION locate(text, text) RETURNS integer
+    AS '
+    SELECT position($1 in $2);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 41 (OID 74299)
+-- Name: locate(text, text, integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION locate(text, text, integer) RETURNS integer
+    AS '
+    SELECT position($1 in substring($2 from $3)) + $3 - 1;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 42 (OID 74300)
+-- Name: right(text, integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "right"(text, integer) RETURNS text
+    AS '
+    SELECT substring($1 from char_length($1) - $2 + 1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 43 (OID 74301)
+-- Name: space(integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION space(integer) RETURNS text
+    AS '
+    SELECT repeat('' '', $1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 44 (OID 74302)
+-- Name: ucase(text); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION ucase(text) RETURNS text
+    AS '
+    SELECT upper($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 45 (OID 74303)
+-- Name: ceiling(numeric); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION ceiling(numeric) RETURNS numeric
+    AS '
+    SELECT ceil($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 46 (OID 74304)
+-- Name: log10(double precision); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION log10(double precision) RETURNS double precision
+    AS '
+    SELECT log($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 47 (OID 74305)
+-- Name: log10(numeric); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION log10(numeric) RETURNS numeric
+    AS '
+    SELECT log($1);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 48 (OID 74306)
+-- Name: power(double precision, double precision); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION power(double precision, double precision) RETURNS double precision
+    AS '
+    SELECT pow($1, $2);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 49 (OID 74307)
+-- Name: power(numeric, numeric); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION power(numeric, numeric) RETURNS numeric
+    AS '
+    SELECT pow($1, $2);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 50 (OID 74308)
+-- Name: rand(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION rand() RETURNS double precision
+    AS '
+    SELECT random();
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 51 (OID 74309)
+-- Name: rand(double precision); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION rand(double precision) RETURNS double precision
+    AS '
+    SELECT setseed($1);
+    SELECT random();
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 52 (OID 74310)
+-- Name: truncate(numeric, integer); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "truncate"(numeric, integer) RETURNS numeric
+    AS '
+    SELECT trunc($1, $2);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 53 (OID 74311)
+-- Name: curdate(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION curdate() RETURNS date
+    AS '
+    SELECT current_date;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 54 (OID 74312)
+-- Name: curtime(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION curtime() RETURNS time with time zone
+    AS '
+    SELECT current_time;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 55 (OID 74313)
+-- Name: odbc_timestamp(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION odbc_timestamp() RETURNS timestamp with time zone
+    AS '
+    SELECT current_timestamp;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 56 (OID 74314)
+-- Name: dayname(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION dayname(timestamp without time zone) RETURNS text
+    AS '
+    SELECT to_char($1,''Day'');
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 57 (OID 74315)
+-- Name: dayofmonth(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION dayofmonth(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(day FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 58 (OID 74316)
+-- Name: dayofweek(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION dayofweek(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(dow FROM $1) AS integer) + 1;
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 59 (OID 74317)
+-- Name: dayofyear(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION dayofyear(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(doy FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 60 (OID 74318)
+-- Name: hour(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "hour"(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(hour FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 61 (OID 74319)
+-- Name: minute(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "minute"(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(minute FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 62 (OID 74320)
+-- Name: month(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "month"(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(month FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 63 (OID 74321)
+-- Name: monthname(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION monthname(timestamp without time zone) RETURNS text
+    AS '
+    SELECT to_char($1, ''Month'');
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 64 (OID 74322)
+-- Name: quarter(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION quarter(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(quarter FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 65 (OID 74323)
+-- Name: second(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "second"(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(second FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 66 (OID 74324)
+-- Name: week(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION week(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(week FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 67 (OID 74325)
+-- Name: year(timestamp without time zone); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION "year"(timestamp without time zone) RETURNS integer
+    AS '
+    SELECT CAST(EXTRACT(year FROM $1) AS integer);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 68 (OID 74326)
+-- Name: odbc_user(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION odbc_user() RETURNS text
+    AS '
+    SELECT CAST(current_user AS TEXT);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 69 (OID 74327)
+-- Name: odbc_current_user(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION odbc_current_user() RETURNS text
+    AS '
+    SELECT CAST(current_user AS TEXT);
+'
+    LANGUAGE sql;
+
+
+--
+-- TOC entry 70 (OID 74328)
+-- Name: odbc_session_user(); Type: FUNCTION; Schema: public; Owner: postgres
+--
+
+CREATE FUNCTION odbc_session_user() RETURNS text
+    AS '
+    SELECT CAST(session_user AS TEXT);
+'
+    LANGUAGE sql;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 5 (OID 114993)
+-- Name: waeup_usedscratchcards; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_usedscratchcards (
+    pin character(16) NOT NULL,
+    sold timestamp without time zone,
+    bank character varying(30),
+    used_by character(16) NOT NULL,
+    used_on timestamp without time zone NOT NULL,
+    used_for character varying(20) NOT NULL
+);
+
+
+--
+-- TOC entry 6 (OID 114993)
+-- Name: waeup_usedscratchcards; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_usedscratchcards FROM PUBLIC;
+GRANT ALL ON TABLE waeup_usedscratchcards TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 7 (OID 115157)
+-- Name: waeup_scratchcard; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_scratchcard (
+    pin character varying(16) NOT NULL,
+    value integer NOT NULL,
+    used_by character varying(16),
+    used_on timestamp with time zone,
+    used_for character varying(20)
+);
+
+
+--
+-- TOC entry 8 (OID 115157)
+-- Name: waeup_scratchcard; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_scratchcard FROM PUBLIC;
+GRANT ALL ON TABLE waeup_scratchcard TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 9 (OID 123388)
+-- Name: waeup_jamb_student; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_jamb_student (
+    fname character varying(64) NOT NULL,
+    lname character varying(64) NOT NULL,
+    bdate date NOT NULL,
+    gender character(1) NOT NULL,
+    studentid character(16) NOT NULL,
+    course_of_study character varying(100),
+    faculty character varying(100) NOT NULL,
+    state_of_origin character varying(100) NOT NULL,
+    mark_english integer,
+    subject2 character(32),
+    subject2marks integer,
+    subject1 character(32),
+    subject1marks integer,
+    subject3 character(32),
+    subject3marks integer,
+    CONSTRAINT waeup_jamb_student_gender CHECK (((gender = 'm'::bpchar) OR (gender = 'f'::bpchar)))
+);
+
+
+--
+-- TOC entry 10 (OID 123388)
+-- Name: waeup_jamb_student; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_jamb_student FROM PUBLIC;
+GRANT ALL ON TABLE waeup_jamb_student TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 11 (OID 123393)
+-- Name: waeup_student; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_student (
+    studentid character(16) NOT NULL,
+    matno character varying(20) NOT NULL,
+    "password" character varying(35),
+    clearance_on date,
+    housing timestamp without time zone,
+    school_fee timestamp without time zone
+);
+
+
+--
+-- TOC entry 12 (OID 123393)
+-- Name: waeup_student; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_student FROM PUBLIC;
+GRANT ALL ON TABLE waeup_student TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 13 (OID 123406)
+-- Name: waeup_acc_house; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_acc_house (
+    house character varying(30) NOT NULL,
+    gender character(1) NOT NULL,
+    beds integer NOT NULL,
+    CONSTRAINT waeup_acc_house_beds CHECK ((beds > 0))
+);
+
+
+--
+-- TOC entry 14 (OID 123406)
+-- Name: waeup_acc_house; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_acc_house FROM PUBLIC;
+GRANT ALL ON TABLE waeup_acc_house TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 15 (OID 123411)
+-- Name: waeup_acc_floor; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_acc_floor (
+    floorno integer NOT NULL,
+    house character varying(30) NOT NULL,
+    gender character(1) NOT NULL,
+    rooms integer NOT NULL
+);
+
+
+--
+-- TOC entry 16 (OID 123411)
+-- Name: waeup_acc_floor; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_acc_floor FROM PUBLIC;
+GRANT ALL ON TABLE waeup_acc_floor TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 17 (OID 123435)
+-- Name: waeup_acc_bedlist; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_acc_bedlist (
+    house character varying(30) NOT NULL,
+    floor integer NOT NULL,
+    room integer NOT NULL,
+    bed integer NOT NULL,
+    gender character(1) NOT NULL,
+    used_by character varying(16),
+    CONSTRAINT waeup_acc_bedlist_bed CHECK ((bed > 0)),
+    CONSTRAINT waeup_acc_bedlist_gender CHECK (((gender = 'm'::bpchar) OR (gender = 'f'::bpchar))),
+    CONSTRAINT waeup_acc_bedlist_room CHECK ((room > 0))
+);
+
+
+--
+-- TOC entry 18 (OID 123435)
+-- Name: waeup_acc_bedlist; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_acc_bedlist FROM PUBLIC;
+GRANT ALL ON TABLE waeup_acc_bedlist TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 19 (OID 123450)
+-- Name: waeup_acc_bed; Type: VIEW; Schema: public; Owner: toni
+--
+
+CREATE VIEW waeup_acc_bed AS
+    SELECT h.house, bl.floor, bl.room, bl.bed, h.gender FROM waeup_acc_house h, waeup_acc_bedlist bl WHERE ((h.house)::text = (bl.house)::text);
+
+
+--
+-- TOC entry 20 (OID 123450)
+-- Name: waeup_acc_bed; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_acc_bed FROM PUBLIC;
+GRANT ALL ON TABLE waeup_acc_bed TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 21 (OID 123451)
+-- Name: waeup_faculties; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_faculties (
+    faculty character varying(30) NOT NULL,
+    school_fee integer NOT NULL,
+    CONSTRAINT school_fee CHECK ((school_fee >= 0))
+);
+
+
+--
+-- TOC entry 22 (OID 123451)
+-- Name: waeup_faculties; Type: ACL; Schema: public; Owner: toni
+--
+
+REVOKE ALL ON TABLE waeup_faculties FROM PUBLIC;
+GRANT ALL ON TABLE waeup_faculties TO imke;
+
+
+SET SESSION AUTHORIZATION 'toni';
+
+--
+-- TOC entry 23 (OID 123828)
+-- Name: waeup_course; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_course (
+    faculty character varying(30),
+    title character varying(60) NOT NULL,
+    courseno character varying(10) NOT NULL,
+    workload integer NOT NULL,
+    CONSTRAINT waeup_course_workload CHECK ((workload >= 0))
+);
+
+
+--
+-- TOC entry 24 (OID 123837)
+-- Name: waeup_courseentry; Type: TABLE; Schema: public; Owner: toni
+--
+
+CREATE TABLE waeup_courseentry (
+    courseno character varying(10),
+    e integer NOT NULL,
+    s1 character(4) NOT NULL,
+    m1 integer NOT NULL,
+    s2 character(4) NOT NULL,
+    m2 integer NOT NULL,
+    s3 character(4) NOT NULL,
+    m3 integer NOT NULL,
+    CONSTRAINT waeup_courseentry_e CHECK ((e >= 0)),
+    CONSTRAINT waeup_courseentry_m1 CHECK ((m1 >= 0)),
+    CONSTRAINT waeup_courseentry_m2 CHECK ((m2 >= 0)),
+    CONSTRAINT waeup_courseentry_m3 CHECK ((m3 >= 0))
+);
+
+
+--
+-- TOC entry 25 (OID 114995)
+-- Name: waeup_usedscratchcards_pkey; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_usedscratchcards
+    ADD CONSTRAINT waeup_usedscratchcards_pkey PRIMARY KEY (pin);
+
+
+--
+-- TOC entry 26 (OID 115159)
+-- Name: waeup_scratchcard_pkey; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_scratchcard
+    ADD CONSTRAINT waeup_scratchcard_pkey PRIMARY KEY (pin);
+
+
+--
+-- TOC entry 27 (OID 123391)
+-- Name: waeup_jamb_student_studentid_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_jamb_student
+    ADD CONSTRAINT waeup_jamb_student_studentid_key UNIQUE (studentid);
+
+
+--
+-- TOC entry 29 (OID 123398)
+-- Name: waeup_student_studentid_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_student
+    ADD CONSTRAINT waeup_student_studentid_key UNIQUE (studentid);
+
+
+--
+-- TOC entry 28 (OID 123400)
+-- Name: waeup_student_matno_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_student
+    ADD CONSTRAINT waeup_student_matno_key UNIQUE (matno);
+
+
+--
+-- TOC entry 30 (OID 123409)
+-- Name: waeup_acc_house_house_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_acc_house
+    ADD CONSTRAINT waeup_acc_house_house_key UNIQUE (house);
+
+
+--
+-- TOC entry 31 (OID 123453)
+-- Name: waeup_faculties_faculty_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_faculties
+    ADD CONSTRAINT waeup_faculties_faculty_key UNIQUE (faculty);
+
+
+--
+-- TOC entry 32 (OID 123831)
+-- Name: waeup_course_courseno_key; Type: CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_course
+    ADD CONSTRAINT waeup_course_courseno_key UNIQUE (courseno);
+
+
+--
+-- TOC entry 71 (OID 123402)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_student
+    ADD CONSTRAINT "$1" FOREIGN KEY (studentid) REFERENCES waeup_jamb_student(studentid);
+
+
+--
+-- TOC entry 72 (OID 123413)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_acc_floor
+    ADD CONSTRAINT "$1" FOREIGN KEY (house) REFERENCES waeup_acc_house(house);
+
+
+--
+-- TOC entry 73 (OID 123444)
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_acc_bedlist
+    ADD CONSTRAINT "$2" FOREIGN KEY (used_by) REFERENCES waeup_student(matno);
+
+
+--
+-- TOC entry 74 (OID 123833)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_course
+    ADD CONSTRAINT "$1" FOREIGN KEY (faculty) REFERENCES waeup_faculties(faculty);
+
+
+--
+-- TOC entry 75 (OID 123843)
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: toni
+--
+
+ALTER TABLE ONLY waeup_courseentry
+    ADD CONSTRAINT "$1" FOREIGN KEY (courseno) REFERENCES waeup_course(courseno);
+
+
+SET SESSION AUTHORIZATION 'postgres';
+
+--
+-- TOC entry 3 (OID 2200)
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
+--
+
+COMMENT ON SCHEMA public IS 'Standard public namespace';
+
+
