Contents
Instead of pausing the logging for a table you can also stop and remove an audit trail. This can be done on schema level with pgmemento.drop
or for a single table with pgmemento.drop_table_audit
. This will remove all triggers and drop the given audit_id
column from a given table. The table will then stop to appear in the audit_tables view.
When you stop a table's audit trail you can choose to log the whole content at last as if the data was truncated. Otherwise, it would be impossible to reference the rows with the audit_id
s. Therefore, you will find a TRUNCATE event in the table_event_log then. This options is set to TRUE by default. With the last argument you can choose if the whole audit trail for the table shall be removed which is FALSE by default. Thus in case, you really want to get rid of the table's history use FALSE and TRUE as the last arguments.
sql
SELECT pgmemento.drop_table_audit('table_A', 'public', 'audit_trail_id', TRUE, FALSE);
Besides, if the audit trail shall remain in the log tables, a final event called DROP AUDIT_ID is logged in the table_event_log table. In the audit_table_log
and audit_column_log
the txid_ranges
of the affected table are closed.
Drop the audit trail CAUTION
If you choose to drop the audit trail, then use FALSE as final parameter for pgmemento.drop_table_audit
. This will call the pgmemento.delete_audit_table_log
function which removes all references of the given table from table_event_log
, row_log
, audit_table_log
and audit_column_log
. This might leave some unreferenced logs in the transaction_log
.