Since v0.3 pgMemento supports DDL logging to capture schema changes. This is important for restoring former table or database states (see restore chapter). The two tables audit_table_log and audit_column_log in the pgMemento schema provide information in which range of transactions the audited tables and their columns exist. After a table is altered or dropped an event trigger is fired to compare the recent state (at ddl_command_end) with the logs. pgMemento also saves data of all rows before a DROP SCHEMA, DROP TABLE or ALTER TABLE ... DROP COLUMN event occurs (at ddl_command_start).

For ALTER TABLE ... ALTER COLUMN events data is only logged either if the data type is changed using an explicit transformation between data types with the signal word USING or if the collation is changed. Logs are not needed if altering the type worked without an explicit cast definition because it means that the current state of the data could be used along with a former version of the table schema. If tables or columns are renamed it is reflected in the audit tables but data is not logged.

The same applies to ADD COLUMN events if logging new values is disabled. If it's enabled then for each row a new log entry will be inserted into the row_log. If a DEFAULT value is defined the new_data column will have this value.

As noted in Initialize auditing chapter, a DDL command with CREATE TABLE, CREATE TABLE AS or SELECT INTO will only fire a trigger if it has been enabled for the schema.