{"record":{"id":"25d1a5f5ab602f67","repo":"SeaQL/sea-orm","slug":"audit-not-supported-for-yet-25d1a5","errorCode":null,"errorMessage":"Audit not supported for {} yet","messagePattern":"Audit not supported for (.+?) yet","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sea-orm-sync/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/sea-orm-sync/src/database/statement.rs#L131-L167","documentation":"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.","triggerScenarios":"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).","commonSituations":"Synchronous apps auditing migration/DDL statements for RBAC; assuming parity between query-statement and schema-statement audit support.","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"],"exampleFix":"// before\nlet audit = schema_statement.audit()?; // todo! panic\n// after\nlet audit = match stmt_kind { StmtKind::Query => Some(stmt.audit()?), _ => None };","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn audit_supported(stmt_kind: StatementKind) -> bool {\n    !matches!(stmt_kind, StatementKind::Schema(_))\n}","tryCatchPattern":"// todo!() panics; guard by statement kind\nif audit_supported(kind) { let a = stmt.audit()?; }","preventionTips":["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"],"tags":["panic","todo","rbac","sync","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"}