just_database 1.1.0
just_database: ^1.1.0 copied to clipboard
A pure-Dart SQL database engine.
Changelog #
1.1.0 - 2026-02-23 #
Added — Secure Mode (AES-256-GCM encryption at rest) #
DatabaseMode.secure— new database mode that encrypts every page written to disk with AES-256-GCM and a per-save random IV. In-memory access is unaffected; encryption is applied only during persistence.SecureKeyManager— new public class inlib/src/core/secure_key_manager.dart(re-exported from the barrel) that manages the AES-256 key lifecycle:resolveKey({dbName, password})— derives a 256-bit key from a user password via PBKDF2-HMAC-SHA256 (100 000 iterations, 16-byte random salt). The salt is generated once, stored inJustSecureStorage, and retrieved on every subsequent call. The password is never written to disk.clearSalt({dbName})— deletes the persisted salt for a database (use before deleting or resetting an encrypted database).resolveAutoKey({dbName})— generates a cryptographically random 32-byte key withRandom.secure(), stores it inJustSecureStorage, and returns it on every subsequent call. No user interaction required.clearAutoKey({dbName})— deletes the auto-managed key for a database.
just_storagecompanion package added as a dependency — providesJustSecureStorage(AES-256-GCM encrypted key-value store) used bySecureKeyManager.encrypt ^5.0.3andcrypto ^3.0.3added as direct dependencies.
Changed — Internal #
class Row(inlib/src/storage/row.dart) renamed toDatabaseRowto avoid shadowing Flutter'sRowwidget. All internal references updated acrosstable.dart,index.dart,executor.dart, andbackup.dart.- All UI import sites that previously had
hide Rowdirectives have been cleaned up.
1.0.0 - 2026-02-20 #
Added — Core Engine #
- Triggers —
BEFORE/AFTERINSERT,UPDATE,DELETE;INSTEAD OFon views;NEW/OLDrow references;WHENclause; multi-statementBEGIN ENDbodies - Views —
CREATE VIEW,DROP VIEW,SELECTagainst views,INSTEAD OFtriggers on views - Transactions (WAL) —
BEGIN [DEFERRED|IMMEDIATE],COMMIT,ROLLBACK,SAVEPOINT,RELEASE SAVEPOINT,ROLLBACK TO SAVEPOINT;transaction()helper with automatic rollback on error - Spatial / R-tree indexes —
Point,BoundingBox,Polygongeometry types;ST_MAKEPOINT,ST_X,ST_Y,ST_DISTANCE,ST_WITHIN,ST_INTERSECTS,ST_CONTAINS,ST_BBOX;CREATE SPATIAL INDEX; quadratic-split R-tree - Query-optimization hints — inline comment hints:
/*+ INDEX(t idx) */,/*+ NO_INDEX */,/*+ FULL_SCAN */,/*+ FORCE_INDEX(idx) */ - Backup & Restore —
exportSql()full SQL dump;importSql()restore;exportJson()/importJson()JSON snapshot;backupToFile/restoreFromFile - Schema Migrations —
SqlMigration(up/down SQL),CallbackMigration(Dart callbacks),MigrationRunnerwith versioned apply/rollback, SHA-256 checksum validation,status()report, persistent_migrationstracking table - Performance Benchmarking —
DatabaseBenchmark(8-op standard suite),BenchmarkSuite(custom suites),QueryStats(avg/min/max/p95/p99/ops-per-sec), configurable warm-up + seed-row count
Added — ORM Layer #
DbRecord— abstract base class; holds auto-managedid; forcestoMap()DbColumn— typed column builder:.integer(),.text(),.real(),.boolean(),.datetime(),.blob()withnotNull,unique,defaultValueDbTable<T>— generic type-safe table accessor; overridetableName,columns,fromRow()to get full CRUD:- DDL:
createTable(),dropTable(),createTableSql() - Insert:
insert()(returns saved record withid),insertAll()(transactional) - Select:
findAll(),findById(),findWhere(),findFirst(),count() - Update:
update(),updateWhere() - Delete:
deleteById(),deleteWhere(),deleteAll() - Raw:
rawQuery()
- DDL:
DbTableException— typed error for all ORM failures
Added — Admin UI #
- Benchmark tab — standard suite runner + custom single-query benchmark; throughput bars, p95/p99 stat cards, copy-to-clipboard results
- Insert Row tab — dynamic form driven by the live table schema; per-column input types (text, number, boolean switch, date picker); inline validation; success/error feedback
- Settings tab redesigned — live DB stats grid (tables/views/rows/triggers/indexes/size), engine-feature reference tiles, About card with version + license + repo
Added — public API on JustDatabase #
runStandardBenchmark({rowCount, warmup, iterations})Future<BenchmarkSuiteResult>benchmarkQuery(label, sql, {warmup, iterations})Future<QueryStats>triggerNamesgetter —List<String>viewNamesgetter —List<String>indexNamesForTable(String)—List<String>totalRowsgetter —intestimatedSizeBytesgetter —int
Added — version constant #
kJustDatabaseVersionconstant inlib/src/version.dart
Fixed (from 0.0.1) #
HAVINGclause with aggregate functions now works correctlyALTER TABLE RENAME COLUMNfully removes old column references- Subqueries now support correlated patterns and
INclauses - R-tree spatial index quadratic split algorithm correctness
Changed #
- 141 tests passing (69 original + 72 new feature tests)
- Admin UI tabs: Databases Schema Insert Query Benchmark Settings
Known Limitations #
- No
FULL OUTER JOIN(INNER, LEFT, RIGHT are supported) - No
CHECKconstraints - No recursive CTEs (
WITH RECURSIVE) BLOBcolumns accept hex-string values in the Insert UI
0.0.1 - 2026-02-20 #
Added #
- Initial release of just_database
- Pure Dart SQL database engine with in-memory storage
- Optional file persistence (path_provider)
CREATE,SELECT,INSERT,UPDATE,DELETEstatementsPRIMARY KEY,UNIQUE,FOREIGN KEY,NOT NULL,DEFAULTconstraints- Composite indexes for multi-column queries
- Automatic query-based indexing (creates indexes after 100+ queries)
- Three concurrency modes:
standard,readFast,writeFast - Query tracking and performance monitoring
- Index metadata with hit ratios and usage statistics
DatabaseManagerfor managing multiple databases- Flutter admin UI: Database management, Schema inspector, SQL query editor, Settings
DatabaseProviderChangeNotifier for state managementINTEGER,REAL,TEXT,BOOLEAN,BLOB,DATETIMEdata typesAUTOINCREMENTsupport for primary keysJOINoperations:INNER JOIN,LEFT JOIN,RIGHT JOIN- Aggregate functions:
COUNT,SUM,AVG,MIN,MAX GROUP BY,HAVING,ORDER BY,LIMIT,OFFSETDISTINCTALTER TABLE:ADD COLUMN,DROP COLUMN,RENAME COLUMN- Scalar subqueries in
SELECTandWHERE - Nested subqueries