[−][src]Function sql_audit::generate_audit
pub async fn generate_audit<'_>(
pool: &'_ PgPool,
exclude_tables: Vec<String>
) -> Result<()>
Generate the audit infrastructure for the database that the passed pool connects to. This
function will:
- Create the
sql_auditschema withaudittable if the schema doesn't yet exist. - Create the
sql_audit_triggerfunction used in all generatedTRIGGERs. - Create triggers for all tables in the
publicschema which are not inexclude_tables.
Limitations
If you try to audit any table which does not have a pk column, the triggers will fail.
Errors
- Connection failure to the provided
poolat any point will generate an error. - Any normal Postgres errors (e.g. user doesn't have the right permissions)