phorm_sqlite 1.9.0
phorm_sqlite: ^1.9.0 copied to clipboard
The SQLite driver and connection manager implementation for the PHORM.
Changelog #
1.9.0 #
- Bulk performance: PHORM now leads the cross-ORM benchmark on inserts and
relationship trees (see
benchmarks/in the repository; 5k-row insert 6.6ms vs ~12ms for drift on an Apple M3, relationship tree 4.2ms vs ~12ms):- batches of same-shape inserts are coalesced into a columnar
BatchInsertMany— column names cross the isolate boundary once and the isolate reuses a single prepared statement for all rows; - table-change notifications from the SQLite update hook are buffered during batches/transactions and flushed once per distinct table after COMMIT, instead of one cross-isolate message per affected row (this was the dominant cost of large batches);
- SELECT results use a columnar transfer (column names once + value lists) instead of one map per row, with maps rebuilt caller-side sharing key instances.
- batches of same-shape inserts are coalesced into a columnar
- Reactive
watch*/changeStreamsemantics are unchanged: listeners still receive one event per modified table after commit.
1.8.0 #
- Batch operations are ~11× faster.
Batch.commit()now sends plain insert/update/delete batches to the database isolate as a single message executed there in one transaction, instead of one isolate round-trip per operation (5000 inserts: ~457ms → ~41ms on an Apple M3). Falls back to the previous per-operation path when results are requested (noResult: false),continueOnErroris set, raw SQL is batched, a non-REPLACE conflict algorithm is used, or an outer transaction is active. DB(onQuery: ...)query observer — a callback invoked for every database operation, independently oflogQueries: successful, slow (perslowQueryThreshold) and failed ones (with error and stack trace). Feed it to metrics, tracing or crash reporting. Requiresphorm ^1.8.0.
1.7.0 #
- Nested transactions via SQLite savepoints.
transaction()can now be called inside another transaction: the outermost call issuesBEGIN/COMMITas before, inner calls create aSAVEPOINTthat is released on success or rolled back on failure. A failed inner transaction undoes only its own writes and does not poison the outer one; an outer rollback still reverts everything. Previously a nested call failed with "cannot start a transaction within a transaction".
1.6.1 #
- Bumped bundled
phormcore to^1.5.0, bringing typed condition composition with the&/|operators (age.gt(18) & (city.eq('Sofia') | city.eq('Plovdiv'))). phorm_generatorstays pinned<1.4.0: generator 1.4.x needsanalyzer ^13(meta ^1.18.3), which conflicts with themetaversion pinned byflutter_teston the current Flutter stable.
1.6.0 #
- New: automatic additive migrations —
DB(autoMigrate: true)(also onDB.autoVersion). On every open, each registered table's live schema is compared with its generatedCREATE TABLEschema; missing tables, columns, indexes and triggers are created automatically — no version bump needed for additive model changes. Destructive or ambiguous changes (dropped/renamed columns, type changes,NOT NULLwithout aDEFAULT,UNIQUE/PRIMARY KEYadditions) are never applied: they are logged with a suggestion to write an explicitTableMigration. Off by default; explicit migrations keep working alongside and remain the tool for data transforms. - Re-enabled most
very_good_analysislints forlib/(generated*.g.dartfiles are excluded from analysis). Internal cleanups with no behavior changes:on Objectcatch clauses, removed unnecessary awaits, singlechangeStreamtear-off subscription.
1.5.1 #
- Bundled
phormcore bumped to^1.4.1:WhereBuildernow escapes columns structurally via the dialect instead of regex replacement over the generated SQL, fixing mis-escaping when a column name coincided with a word inside the SQL template (e.g. a column namedLOWERorDATE) and properly escapingSqlFunctionColumninner columns.
1.5.0 #
- BREAKING: bundled
phormcore bumped to^1.4.0— automatic timestamps (created_at,updated_at,deleted_at) are now written in UTC instead of local time. New records sort consistently across devices/timezones; rows written by earlier versions keep their local-time values. - Migration
applied_attimestamps are now written in UTC as well.
1.4.1 #
- Raise the default
DB.isolateThresholdfrom50to2000. Result-set parsing only moves to a background isolate once inline parsing would risk a dropped frame; below that the isolate spawn + row copy was pure overhead. Seebenchmark/parse_benchmark.dartin thephormpackage for the measurements. - Document the
isolateThresholdtuning knob in the README.
1.4.0 #
- Upgrade to
sqlite3^3.3.4,sqlite3_flutter_libs^0.6.0 andsqlite3_web^0.9.2. Migrate the isolate backends off the deprecateddispose()in favor ofclose(). Raises the Dart SDK floor to>=3.10.0(required bysqlite3_web0.9). - Add
topicstopubspec.yamlfor pub.dev discoverability. - Note: the
phorm_generatordev-dependency is temporarily pinned to<1.4.0, as generator 1.4.0 pulls analyzer 13 (meta ^1.18.3) which conflicts with themetaversion pinned by the current Flutter SDK.
1.3.0 #
- Auto-generated pivot tables (from
@ManyToMany(createPivot: true)) are now created on database upgrade as well, not only on first creation: anyIF NOT EXISTS-guarded statement in a table's schema is re-applied when the owning table already exists. - Added an informational log line when a pivot table is created alongside its
model table (e.g.
Also creating pivot table: user_roles).
1.2.0 #
- Bumped
phormdependency to^1.2.0(andphorm_generatordev dependency to^1.2.0), exposing the new@Schema(generateFullService: ...)option. - Bumped
sqlite3_webto^0.4.1.
1.1.0 #
- Bumped
phormdependency to^1.1.0andphorm_generator(dev) to^1.1.0. - 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
1.0.1 #
- Updated README with badges
- Removed commented workspace resolution configuration
1.0.0 #
- First stable release of the PHORM SQLite Driver.
- Implements
phormruntime database execution layer on top ofsqlite3. - Dedicated multi-thread background isolate executor ensuring synchronous SQLite operations never block the main/UI thread.
- Out-of-the-box Flutter Web support via WebAssembly (
sqlite3_web) and persistent IndexedDB file system. - Transparent database versioning and smart idempotent migration lifecycle tracking via the
__phorm_migrationstable. - High-performance slow query tracer and console loggers.
- Built-in SQLCipher encryption support for Native (iOS, Android, Desktop) platforms.
- Native Dart
SqlFunctionregistration (including regexp support).