phorm 1.7.0
phorm: ^1.7.0 copied to clipboard
PHORM — a lightweight, type-safe, driver-agnostic ORM for Dart and Flutter.
Changelog #
1.7.0 #
- Nested writes —
PhormCore.insertWith(item, {...})inserts a model together with related children in one transaction:HasMany/HasOnechildren get the parent's key stamped into their foreign key column (falling back to the returned row id for fresh autoincrement parents),ManyToManychildren are inserted along with their pivot rows.BelongsToentries are rejected with a clear error. Any failure rolls the whole transaction back.
1.6.0 #
- Keyset (cursor) pagination —
PhormQuery.after(lastModel)returns rows strictly after the given model in the currentorderByordering. The primary key is appended automatically as a tiebreaker (to both ORDER BY and the cursor), duplicates and mixed ASC/DESC sorts are handled, and unlikeoffsetthe page stays stable under concurrent inserts/deletes.SortBuildernow exposes its structuredentries. - Fluent query API extensions on
PhormQuery:distinct()—SELECT DISTINCT;select([...])— column subset shorthand forattributes(Attributes.include([...])), acceptsPhormColumns or names;groupBy([...])+having(condition)— grouping with a typed HAVING condition (explicitgroupByreplaces the automatic primary-key grouping used for join deduplication);rows()— executes the query and returns raw rows without model mapping, for grouped/aggregate results;noLimit()— removes the default limit of 20 rows.
PhormCore.readRows(...)— row-level counterpart ofreadAll(same soft-delete handling, no model mapping);readAll/readAllWithCountacceptlimit: null(no LIMIT) anddistinct.WhereBuilder.buildaccepts an optional sharedParamIndex, so WHERE and HAVING number their placeholders sequentially in$ndialects.
1.5.0 #
- New: condition composition with
&/|— typed conditions now combine into AND/OR groups without dropping down toWhereBuilder:Users.where(UserTable.age.gt(18) & (UserTable.city.eq('Sofia') | UserTable.city.eq('Plovdiv')))compiles toage > ? AND (city = ? OR city = ?). Groups nest freely; Dart's operator precedence (&over|) matches SQL. Requiresphorm_annotations ^1.5.0(which introducesPhormConditionGroup). - Re-enabled most
very_good_analysislints (the ignore list shrank from 25 to 7 deliberate style rules): documented the remaining public members,on FormatExceptioninstead of a bare catch in JSON parsing, removed an unnecessary await. No API or behavior changes.
1.4.2 #
- Internal refactor, no API changes:
core.dartandwhere_builder.dartsplit into focused files — JOIN/JSON-aggregation query building extracted intoJoinQueryBuilder(PhormCore.buildJoinQuerynow delegates to it), the sealed condition hierarchy moved to awhere_condition.dartpart, andWhereBuilderExtensions/WhereBuildersmoved towhere_builder_helpers.dart(still exported frompackage:phorm/phorm.dart).
1.4.1 #
WhereBuildernow compiles conditions structurally: the column is stored separately from the SQL template and escaped viaSqlDialect.escapeIdentifierdirectly, instead of regex word-boundary replacement over the generated SQL. Fixes potential mis-escaping when a column name coincided with a word inside the SQL template (e.g. a column namedLOWERorDATE), andSqlFunctionColumninner columns are now properly escaped.raw()conditions remain verbatim (no escaping), as before.- Internal condition storage is a sealed class hierarchy instead of
dynamic.
1.4.0 #
- BREAKING: automatic timestamps (
created_at,updated_at,deleted_at) are now written in UTC (DateTime.now().toUtc()) instead of local time. New records sort consistently across devices/timezones; rows written by earlier versions keep their local-time values.
1.3.0 #
- Bumped
phorm_annotationsdependency to^1.3.0, which adds the@ManyToMany(createPivot: ...)and@ManyToMany(pivotForeignKeys: ...)options (re-exported byphorm) for automatically generating the pivot (join) table of a many-to-many relationship.
1.2.0 #
- Bumped
phorm_annotationsdependency to^1.2.0, which adds the@Schema(generateFullService: ...)option (re-exported byphorm) and carries theMigrationBuilder.build()fix (previously droppedcolumns,timestamps, andautoIncrementwhen rebuilding a table via the fluent migration API).
1.1.0 #
- Bumped
phorm_annotationsdependency to^1.1.0(addsSqlDialectKindand the@Schema(dialect: ...)option). - Version bump to keep all PHORM packages in sync.
1.0.3 #
- Version bump to keep all PHORM packages in sync.
1.0.2 #
- Updated SDK environment constraint to >=3.7.0 <4.0.0
- Updated README with badges
1.0.1 #
- Changed license to MIT
- Changed logo
- Updated README
1.0.0 #
- First stable release of the PHORM Core.
- Driver-agnostic runtime query builder (
WhereBuilder,SortBuilder). - Generic CRUD service (
PhormCore<T extends Model>) with optionalDatabaseExecutorfor transaction support. - Seamless relational eager loading through Single-Query JSON Aggregation.
- Complete support for soft deletes (Paranoid mode) and automatic date timestamps.
- Native transaction wrapper and batch operation helpers (
insertBatch,updateBatch,deleteBatch, etc.).