33Since v4.0, there are various options for persisting Store data to and from
44SQLite databases, via a range of third-party modules.
55
6- There are currently twelve SQLite-based persistence options, and four for
7- PostgreSQL:
6+ There are currently twelve SQLite-based persistence options, four for
7+ PostgreSQL, and one for SQL Server :
88
99| Persister | Storage |
1010| -------------------------- | ---------------------------------------------------------------------------------------------------------------- |
@@ -20,6 +20,7 @@ PostgreSQL:
2020| ElectricSqlPersister | Electric SQL, via [ electric] ( https://github.com/electric-sql/electric ) |
2121| LibSqlPersister | LibSQL for Turso, via [ libsql-client] ( https://github.com/tursodatabase/libsql-client-ts ) |
2222| PowerSyncPersister | PowerSync, via [ powersync-sdk] ( https://github.com/powersync-ja/powersync-js ) |
23+ | MsSqlPersister | SQL Server and Azure SQL, via [ mssql] ( https://github.com/tediousjs/node-mssql ) |
2324| PgPersister | PostgreSQL, via [ pg] ( https://github.com/brianc/node-postgres ) |
2425| PostgresPersister | PostgreSQL, via [ postgres] ( https://github.com/porsager/postgres ) |
2526| PglitePersister | PostgreSQL, via [ PGlite] ( https://github.com/electric-sql/pglite ) |
@@ -39,6 +40,21 @@ and `Client` objects can be passed straight to the createPgPersister function,
3940which means you can persist a Store to PostgreSQL from an edge runtime that
4041cannot open a regular TCP connection.
4142
43+ The MsSqlPersister covers the SQL Server family, and since Azure SQL Database
44+ and Azure SQL Managed Instance both speak the same protocol, the same
45+ createMsSqlPersister function works against all three. It takes a ` mssql `
46+ connection pool that you have configured yourself, so the passwordless
47+ authentication that Microsoft recommends for applications hosted in Azure is a
48+ matter of how you build that pool rather than anything TinyBase needs to know
49+ about. Only the JSON mode described below is available to it so far.
50+
51+ It also differs in how it notices changes made by other writers. The PostgreSQL
52+ Persisters use LISTEN and NOTIFY, which has no equivalent that works across
53+ every flavor of SQL Server, so the MsSqlPersister adds a ` rowversion ` column to
54+ its table and polls that instead. SQL Server maintains that column itself on
55+ every insert and update, which keeps external changes detectable without
56+ requiring Service Broker, Change Tracking, or triggers.
57+
4258The SupabasePersister is the odd one out, since it talks to Supabase's REST API
4359rather than to the database directly. That means it runs in a browser or edge
4460runtime, that row-level security policies apply to what it reads and writes,
0 commit comments