dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10401
Re: Data audit table..is it being used?
Hi Jason,
We have the service for this already, however the code that calls the
service maybe be reverted.
I will find out and fix it ASAP.
Best regards,
Quang
On Thu, Feb 3, 2011 at 4:36 AM, Jason Pickering <jason.p.pickering@xxxxxxxxx
> wrote:
> I have a question regarding the datavalue_audit table. Is it actually
> used for anything? Based on a requirement here, we need to implement a
> data audit procedure whereby updates or deletes to values are
> recorded. It would seem that changes to data values are not recorded
> in the datavalue_audit table/object. I would sort of think that this
> was the purpose of the data audit table, but it did not seem to behave
> as I thought it would.
>
> A database procedure such as the one at the end of this mail does what
> we want, but not sure what the implication of putting values in this
> table actually is. Perhaps it better to put it in a separate schema
> outside of this public schema used by DHIS2?
>
> Thoughts?
>
> Regards,
> JPP
>
>
> CREATE OR REPLACE FUNCTION update_routine_data() RETURNS trigger AS
> $datavalue_audit$
>
> BEGIN
>
> INSERT INTO datavalue_audit(dataelementid, periodid,sourceid,
> categoryoptioncomboid,value, storedby, lastupdated,comment)
> VALUES (old.dataelementid, old.periodid,old.sourceid,
> old.categoryoptioncomboid,old.value, old.storedby,
> old.lastupdated,old.comment);
> RETURN old;
>
> END;
> $datavalue_audit$
> LANGUAGE plpgsql;
>
>
> CREATE TRIGGER dv_audit AFTER UPDATE OR DELETE ON datavalue FOR EACH
> ROW EXECUTE PROCEDURE update_routine_data();
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+260974901293
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
References