{"record":{"id":"88b1f7c8dcdb7d0a","repo":"SeaQL/sea-orm","slug":"audit-not-supported-for-yet","errorCode":null,"errorMessage":"Audit not supported for {} yet","messagePattern":"Audit not supported for (.+?) yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/database/statement.rs","lineNumber":149,"sourceCode":"}\n\nbuild_query_stmt!(sea_query::InsertStatement);\nbuild_query_stmt!(sea_query::SelectStatement);\nbuild_query_stmt!(sea_query::UpdateStatement);\nbuild_query_stmt!(sea_query::DeleteStatement);\nbuild_query_stmt!(sea_query::WithQuery);\n\nmacro_rules! build_schema_stmt {\n    ($stmt: ty) => {\n        impl StatementBuilder for $stmt {\n            fn build(&self, db_backend: &DbBackend) -> Statement {\n                let stmt = build_any_stmt!(self, db_backend);\n                Statement::from_string(*db_backend, stmt)\n            }\n\n            #[cfg(feature = \"rbac\")]\n            fn audit(&self) -> Result<QueryAccessAudit, AuditError> {\n                todo!(\"Audit not supported for {} yet\", stringify!($stmt))\n            }\n        }\n    };\n}\n\nbuild_schema_stmt!(sea_query::TableCreateStatement);\nbuild_schema_stmt!(sea_query::TableDropStatement);\nbuild_schema_stmt!(sea_query::TableAlterStatement);\nbuild_schema_stmt!(sea_query::TableRenameStatement);\nbuild_schema_stmt!(sea_query::TableTruncateStatement);\nbuild_schema_stmt!(sea_query::IndexCreateStatement);\nbuild_schema_stmt!(sea_query::IndexDropStatement);\nbuild_schema_stmt!(sea_query::ForeignKeyCreateStatement);\nbuild_schema_stmt!(sea_query::ForeignKeyDropStatement);\n\nmacro_rules! build_type_stmt {\n    ($stmt: ty) => {\n        impl StatementBuilder for $stmt {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/SeaQL/sea-orm/blob/e29bcd1b417c41a553b386fe94511d7c64a1c8ec/src/database/statement.rs#L131-L167","documentation":"Schema statements (e.g. TableCreateStatement) generated by the build_schema_stmt! macro implement audit() with todo!() under the rbac feature. Calling audit() on such a statement always panics with 'Audit not supported for {stmt} yet' — the rbac access-audit API has no implementation for schema DDL statements.","triggerScenarios":"Enabling the rbac feature and calling .audit() on a Database/SchemaStatement wrapping a TableCreateStatement (or any statement type built by build_schema_stmt! in src/database/statement.rs:150+).","commonSituations":"Auditing DDL/migration statements for access control; assuming audit() works uniformly across all statement kinds once the rbac feature is enabled.","solutions":["Only call audit() on query statements that implement it; skip auditing for schema/DDL statements","Guard the call with a statement-kind check and treat audit as not-applicable for DDL","Implement (or request) audit support for the specific schema statement type in the library"],"exampleFix":"// before\nlet audit = schema_statement.audit()?; // panics via todo!\n// after\nlet audit = if is_query_statement(&stmt) { Some(stmt.audit()?) } else { None };","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn audit_supported(stmt_kind: StatementKind) -> bool {\n    // schema statements (TableCreateStatement etc.) do not implement audit under rbac\n    !matches!(stmt_kind, StatementKind::Schema(_))\n}","tryCatchPattern":"// todo!() panics; never call on schema statements\nif audit_supported(kind) { let a = stmt.audit()?; } // else skip","preventionTips":["Track which statement kinds implement audit() under the rbac feature","Never audit DDL/migration statements","Wrap audit calls behind a statement-kind check or capability flag"],"tags":["panic","todo","rbac","unimplemented"],"backgroundTag":"method-not-implemented","analyzedSha":"e29bcd1b417c41a553b386fe94511d7c64a1c8ec","analyzedAt":"2026-09-10T11:31:52.468Z","contentChangedAt":"2026-09-10T11:31:52.468Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}