I am creating audit tables for my database using sqlalchemy-postgresql-audit but the issue is that it creates a separate audit_table for every table and I wan't to create a common audit_table for all which contains
------------------------------------------------------------
| transaction(insertion/updation/deletion) | data. |
------------------------------------------------------------
I have edited the source code to create a common table for all by extend_existing=True and I wan't to add the the data of transacted row as JSON in data.
How can I achieve that?
I got the answer for this
When trigger is applies a RECORD for the OLD ROW in case of UPDATION and DELETION and NEW ROW in case of UPDATION and INSERTION is created i.e we can access values using
OLD.(column_name) or NEW.(column_name)
And to enter the entire ROW as JSON in data field
to_json(NEW) or to_json(OLD)
will work