by tracker1 · 3y ago · 0 comments
https://www.sqlite.org/json1.html
Edit: where is the database file stored? A parameter for the Database() constructor seems obvious, but not seeing it in the basic sample.
It looks like your tables have a single value column and a id generated column that extracts $.id from that value:
CREATE TABLE IF NOT EXISTS ${collection} (
value TEXT,
id TEXT GENERATED ALWAYS AS (json_extract(value, "$.id")) VIRTUAL NOT NULL
)
GENERATED ALWAYS AS was added in a relatively recent SQLite version - 2020-01-22 (3.31.0) - do you have a feel for how likely it is for Node.js users to be stuck on an older version? I've had a lot of concern about Python users who are on a stale SQLite for my own projects.