From e2c3fc63cd89b38995d8b6559c36749ae6e6db9f Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 21 Sep 2005 15:26:13 +0000 Subject: [PATCH] simple setup for reporter thingy git-svn-id: svn://svn.open-ils.org/ILS/trunk@1843 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/reporter/config.sql | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Open-ILS/src/reporter/config.sql diff --git a/Open-ILS/src/reporter/config.sql b/Open-ILS/src/reporter/config.sql new file mode 100644 index 0000000000..52116928bf --- /dev/null +++ b/Open-ILS/src/reporter/config.sql @@ -0,0 +1,47 @@ +DROP SCEMA reporter CASCADE; +CREATE SCHEMA reporter; + +BEGIN; + +CREATE TABLE reporter.stage2 ( + id serial primary key, + stage1 text not null, + filename text not null, + owner int not null, + pub bool not null + default false, + create_date timestamp with time zone not null + default now(), + edit_date timestamp with time zone not null + default now() +); + +CREATE OR REPLACE FUNCTION reporter.force_edit_date_update () RETURNS TRIGGER AS $$ + BEGIN + NEW.edit_date = NOW(); + RETURN NEW; + END; +$$ LANGUAGE PLPGSQL; + +CREATE TRIGGER force_edit_date_update_trig + BEFORE UPDATE ON reporter.stage2 + FOR EACH ROW + EXECUTE PROCEDURE reporter.force_edit_date_update (); + +CREATE TABLE reporter.stage3 ( + id serial primary key, + stage2 int not null + references reporter.stage2 (id) + on delete restrict + deferrable + initially deferred, + filename text not null, + owner int not null, + pub bool not null + default false, + create_date timestamp with time zone not null + default now() +); + +COMMIT; + -- 2.43.2