You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Return owned Database handles and propagate errors
Refactor global DB access to return owned Database handles and make internal connection access fallible. Many call sites now propagate Result errors (use ?), and Database internal accessors (__internal_connection, __internal_backend, __get_connection) return Result to avoid silently bypassing transaction scopes or panicking on disconnected handles. TideConfig schema path storage was changed from &'static str to owned String to prevent leaks and allow safe reconfiguration, and TideConfig::schema_file_path() now returns Option<String>. Restored Model::to_hash_map() behavior that omits structured presenter `params` (documented and tested), added profiling short-circuit to skip Instant::now() when global profiling is disabled, and reworked SelfRefMany::load_tree() to fetch trees with a single recursive CTE (honors configured local_key). Updated docs and changelog and added/adjusted tests to cover schema path replacement, profiling, presenter serialization, self-ref SQL, and disconnected-handle behavior.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
10
10
### Fixed
11
11
12
+
- Restored transaction scoping for TideORM model and query helpers so `save()`, `update()`, `delete()`, eager loading, nested operations, full-text reads, and aggregate helpers now honor the active transaction instead of bypassing it through the global pooled connection.
13
+
- Hardened raw SQL builder escape hatches by rejecting obvious injection markers in `where_raw`, raw column expressions, and nested subqueries before execution.
14
+
- Restored the original `Model::to_hash_map()` behavior that hides structured presenter `params` payloads entirely; `params` remains a reserved presenter key and is now documented as such.
15
+
- Removed disabled-path profiling overhead in `__profile_future()` by skipping `Instant::now()` when global profiling is off.
16
+
- Replaced leaked schema-path storage in `TideConfig` so repeated `apply()` and `connect()` calls no longer leak each configured schema file path.
17
+
- Reworked `SelfRefMany::load_tree()` to use a single recursive CTE query, eliminating per-node descendant lookups and honoring the configured `local_key` when walking self-referential trees.
12
18
- Repaired all-features build breakage after the reconfigurable global-database refactor by updating direct SeaORM call sites to borrow owned internal connections correctly.
13
19
- Restored consistent full-text SQL parameterization coverage across the query and full-text test suites, including PostgreSQL ranked search placeholders and SQLite FTS pagination bindings.
14
20
- Tightened encrypted-field missing-key coverage so integration tests now assert the actionable startup-configuration error message returned by `Encrypted<T>`.
15
21
16
22
### Changed
17
23
24
+
-`require_db()`, `try_db()`, `TideConfig::db()`, `TideConfig::try_db()`, `Model::db()`, and `Model::database()` now return owned `Database` handles for consistency with transaction-aware current-connection access.
25
+
-`TideConfig::schema_file_path()` now returns `Option<String>` instead of `Option<&'static str>` so schema path state can be replaced safely without leaking memory across reconfiguration.
18
26
- Documented resettable global configuration, tokenization override reset behavior, and the batched nested many-model save/update/delete paths in the README and mdBook chapters.
Copy file name to clipboardExpand all lines: docs/models.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,15 @@ The `#[tideorm::model]` macro automatically implements:
25
25
-`Serialize` - for JSON serialization
26
26
-`Deserialize` - for JSON deserialization
27
27
28
+
### Reserved Attribute Names
29
+
30
+
`params` is reserved for presenter payloads.
31
+
32
+
When TideORM builds `to_hash_map()` output and the serialized `params` value is
33
+
an object or array, it is omitted from the resulting map. Avoid using `params`
34
+
for presenter-facing structured model attributes if you need that data to appear
35
+
in `to_hash_map()` output.
36
+
28
37
### Custom Implementations (When Needed)
29
38
30
39
If you need custom implementations, use `skip_derives` and provide your own:
@@ -860,12 +869,15 @@ let has_manager = manager_rel.exists().await?;
860
869
letreports=reports_rel.load().await?;
861
870
letcount=reports_rel.count().await?;
862
871
863
-
// Load entire subtree recursively
872
+
// Load entire subtree recursively in one recursive CTE query
864
873
lettree=reports_rel.load_tree(3).await?; // 3 levels deep
865
874
```
866
875
867
876
Note: `SelfRef` and `SelfRefMany` are runtime wrappers today. The derive macro does not yet provide `#[tideorm(self_ref = ...)]` or `#[tideorm(self_ref_many = ...)]` field wiring.
868
877
878
+
`SelfRefMany::load_tree()` respects the configured `local_key` and fetches the
879
+
tree in one query, which avoids one SELECT per node on large hierarchies.
880
+
869
881
### Nested Save (Cascade Operations)
870
882
871
883
Save parent and related models together with automatic foreign key handling:
0 commit comments