# Extension points — SeaQL/sea-orm

> Canonical page: https://codevetter.com/unpack/sea-orm/extension-points

# Extension points — SeaQL/sea-orm

Scanned commit db40a19a7bde7be8e1c4b346b1b70d72e87f0245 (2026-09-27). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

The main extension mechanisms are Rust traits, derive attributes, callback factories, and entity registration. Tooling adds command enums and generation backends, while examples expose framework-specific route tables. Extensions should preserve the common connection boundary and account for optional features and synchronous parity.
- ConnectionTrait is the shared execution interface accepted by ORM methods, allowing pool, transaction, mock, and custom implementations to support the same mutation and select APIs; StreamTrait adds a separate associated stream contract. — [src/database/connection.rs#L10-L64](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/database/connection.rs#L10-L64) [src/database/connection.rs#L67-L94](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/database/connection.rs#L67-L94)
- ProxyDatabaseTrait is the custom backend adapter contract for query and execute results, with overridable transaction/ping hooks; Database::connect_proxy accepts an Arc<Box<dyn ProxyDatabaseTrait>> and a dialect. — [src/database/proxy.rs#L6-L30](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/database/proxy.rs#L6-L30) [src/database/mod.rs#L217-L240](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/database/mod.rs#L217-L240)
- ActiveModelBehavior provides new, before_save, after_save, before_delete, and after_delete hooks; save hooks receive the insert/update distinction, and before hooks can abort by returning DbErr. — [src/entity/active_model.rs#L1077-L1117](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/entity/active_model.rs#L1077-L1117) [src/entity/active_model.rs#L225-L235](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/entity/active_model.rs#L225-L235) [src/entity/active_model.rs#L347-L355](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/entity/active_model.rs#L347-L355)
- EntityRegistry uses inventory::collect and a re-exported submit macro; each registration carries module_path and a schema-info factory, and build_schema selects registrations through normalized module-prefix matching. — [src/entity/registry.rs#L4-L24](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/entity/registry.rs#L4-L24) [src/entity/registry.rs#L26-L56](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/entity/registry.rs#L26-L56)
- MigrationTrait supplies up/down and transaction-policy hooks; MigratorTrait supplies the ordered boxed migration list and overridable tracking-table name, while run_cli_with_connection accepts a connection factory. — [sea-orm-migration/src/lib.rs#L20-L42](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-migration/src/lib.rs#L20-L42) [sea-orm-migration/src/migrator.rs#L52-L71](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-migration/src/migrator.rs#L52-L71) [sea-orm-migration/src/cli.rs#L22-L50](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-migration/src/cli.rs#L22-L50)
- Codegen changes plug into EntityFormat, EntityWriterContext, and format-specific writer branches; context supports custom model/enum/column derives, attributes, serialization policy, date/time representation, and schema names. — [sea-orm-codegen/src/entity/writer.rs#L71-L109](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-codegen/src/entity/writer.rs#L71-L109) [sea-orm-codegen/src/entity/writer.rs#L226-L267](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-codegen/src/entity/writer.rs#L226-L267) [sea-orm-codegen/src/entity/writer.rs#L334-L385](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/sea-orm-codegen/src/entity/writer.rs#L334-L385)
- ConnectOptions stores backend option and pool-option callbacks plus an after-connect callback; PostgreSQL applies these during pool construction, and query metrics expose elapsed time, statement, and failure state to an optional callback. — [src/database/mod.rs#L138-L170](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/database/mod.rs#L138-L170) [src/driver/sqlx_postgres.rs#L94-L96](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/driver/sqlx_postgres.rs#L94-L96) [src/driver/sqlx_postgres.rs#L117-L163](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/driver/sqlx_postgres.rs#L117-L163) [src/metric.rs#L8-L33](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/metric.rs#L8-L33)
- Dynamic Entity::from_entity exports typed entity metadata into runtime columns and ModelType fields; application integrations add endpoints through Actix init registrations, the PostRpc method trait, or Rocket merged endpoint/documentation mounts. — [src/dynamic/entity.rs#L46-L76](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/src/dynamic/entity.rs#L46-L76) [examples/actix_example/api/src/lib.rs#L212-L219](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/examples/actix_example/api/src/lib.rs#L212-L219) [examples/jsonrpsee_example/api/src/lib.rs#L22-L39](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/examples/jsonrpsee_example/api/src/lib.rs#L22-L39) [examples/rocket_okapi_example/api/src/lib.rs#L63-L69](https://github.com/SeaQL/sea-orm/blob/db40a19a7bde7be8e1c4b346b1b70d72e87f0245/examples/rocket_okapi_example/api/src/lib.rs#L63-L69)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
