[−][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_audit
schema withaudit
table if the schema doesn't yet exist. - Create the
sql_audit_trigger
function used in all generatedTRIGGER
s. - Create triggers for all tables in the
public
schema 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
pool
at any point will generate an error. - Any normal Postgres errors (e.g. user doesn't have the right permissions)