SeaQL/sea-orm · error
Audit not supported for {} yet
Error message
Audit not supported for {} yet What it means
Identical to the async variant: in sea-orm-sync, schema statements built by build_schema_stmt! provide audit() only as todo!() under the rbac feature. Calling audit() on a schema (DDL) statement such as TableCreateStatement panics with this message.
Source
Thrown at sea-orm-sync/src/database/statement.rs:149
}
build_query_stmt!(sea_query::InsertStatement);
build_query_stmt!(sea_query::SelectStatement);
build_query_stmt!(sea_query::UpdateStatement);
build_query_stmt!(sea_query::DeleteStatement);
build_query_stmt!(sea_query::WithQuery);
macro_rules! build_schema_stmt {
($stmt: ty) => {
impl StatementBuilder for $stmt {
fn build(&self, db_backend: &DbBackend) -> Statement {
let stmt = build_any_stmt!(self, db_backend);
Statement::from_string(*db_backend, stmt)
}
#[cfg(feature = "rbac")]
fn audit(&self) -> Result<QueryAccessAudit, AuditError> {
todo!("Audit not supported for {} yet", stringify!($stmt))
}
}
};
}
build_schema_stmt!(sea_query::TableCreateStatement);
build_schema_stmt!(sea_query::TableDropStatement);
build_schema_stmt!(sea_query::TableAlterStatement);
build_schema_stmt!(sea_query::TableRenameStatement);
build_schema_stmt!(sea_query::TableTruncateStatement);
build_schema_stmt!(sea_query::IndexCreateStatement);
build_schema_stmt!(sea_query::IndexDropStatement);
build_schema_stmt!(sea_query::ForeignKeyCreateStatement);
build_schema_stmt!(sea_query::ForeignKeyDropStatement);
macro_rules! build_type_stmt {
($stmt: ty) => {
impl StatementBuilder for $stmt {View on GitHub (pinned to e29bcd1b41)
Solutions
- Do not audit DDL statements; restrict audit() calls to supported query statements
- Branch on statement kind before auditing and skip/None for schema statements
- Implement or upstream the missing audit() support for schema statement types
Example fix
// before
let audit = schema_statement.audit()?; // todo! panic
// after
let audit = match stmt_kind { StmtKind::Query => Some(stmt.audit()?), _ => None }; Defensive patterns
Strategy: type-guard
Type guard
fn audit_supported(stmt_kind: StatementKind) -> bool {
!matches!(stmt_kind, StatementKind::Schema(_))
} Try / catch
// todo!() panics; guard by statement kind
if audit_supported(kind) { let a = stmt.audit()?; } Prevention
- Restrict audit() usage to query statements in sea-orm-sync
- Skip auditing for schema statements built via build_schema_stmt!
- Add a unit test that audit is only invoked for query statements
When it happens
Trigger: With the rbac feature enabled in sea-orm-sync, invoking .audit() on a schema statement created from sea_query::TableCreateStatement (or other build_schema_stmt! types).
Common situations: Synchronous apps auditing migration/DDL statements for RBAC; assuming parity between query-statement and schema-statement audit support.
Related errors
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/25d1a5f5ab602f67.
Report an issue: GitHub.