Releases: DallasHoff/sqlocal
Releases · DallasHoff/sqlocal
0.12.0
- Add
deleteDatabaseFile
method - Add optional callback to the
overwriteDatabaseFile
method which is called after the overwrite but before connections from otherSQLocal
client instances are allowed to access the new database. The newdeleteDatabaseFile
method has a similar callback. - Add
onConnect
hook that runs when theSQLocal
instance initializes for the first time and anytimeoverwriteDatabaseFile
ordeleteDatabaseFile
is called on the database connected to that instance.
0.11.4
ReadableStream<Uint8Array>
has been added to the accepted input types ofoverwriteDatabaseFile
, allowing the database file to be streamed into the OPFS in chunks. Also, ifoverwriteDatabaseFile
is passed aFile
orBlob
, it now streams those usingReadableStream
as well.- Removed
nanoid
dependency (Contributed by @filipe-freire)
0.11.3
- Fix deadlock that could happen when a transaction is started while a different transaction is in progress
0.11.2
- If
SQLocal
is initialized in a server-side environment, it no longer throws an error. This helps simplify code structure in server-side rendered apps. Of course, queries must still be made in browser-only code paths. (Contributed by @donpark) getDatabaseFile
now uses SQLite'sVACUUM
command to return a snapshot of the database file, which can also reduce the returned file's size by cleaning up unused space and defragmenting the database.- Mark the package as "side-effect free" to improve tree-shaking performed by bundlers.
0.11.1
- Fix database returning stale data after calling
overwriteDatabaseFile
on it - Fix build error when
drizzle-orm
is not installed
0.11.0
- The
transaction
method has been reworked with a new implementation. Its new API allows running arbitrary logic between the SQL queries executed as part of a transaction while still ensuring that the transaction is atomic and isolated. - The
SQLocalKysely
dialect has been modified so that Kysely'stransaction
method uses SQLocal's new transaction functionality, which allows it to ensure isolation of transactions run using it. - A warning has been added to the
SQLocalDrizzle
driver that is logged when using Drizzle'stransaction
method since that method cannot ensure the transaction's isolation. It recommends using SQLocal'stransaction
method instead, as documented here. - The previous implementation of the
transaction
method is now namedbatch
.
0.10.2
- The
SQLocal
constructor can now accept an object with additional options to define the behavior of the client. For now, this includes 2 new options:readOnly
andverbose
- The
sql
method can now be called with a plain string if needed (e.g.sql('SELECT * FROM foo')
), instead of as a tagged template - The
sql
method's type parameter was changed to represent one record in the query result (extends Record<string, any>
), instead of an array of results (extends Record<string, any>[]
), and a matching type parameter was added to thetransaction
method to allow assertion of the return type of queries
0.10.1
- The file returned by
getDatabaseFile
now has the MIME typeapplication/x-sqlite3
, instead of an empty MIME type - Fix
getDatabaseFile
failing for databases not stored at the root of the origin private file system
0.10.0
- Add
getDatabaseInfo
method - The
destroy
method now executesPRAGMA optimize
on the database before closing the connection - In a future update, the
transaction
method will be reworked, and the current version of the method will be namedbatch
. This update adds abatch
method that is an alias oftransaction
.
0.9.0
- Add
createScalarFunction
method