Commit Graph
14 Commits
Author SHA1 Message Date
tbenandClaude Opus 5.5 938a1da71d Add queue tables, quote SQL identifiers (v1.3.0)
- isQueue table option adds queue columns and a (status, available_at)
  index; BunSQLite.queue exposes add, claim, complete, fail and
  release_stale with atomic claims
- Set busy_timeout on connections so workers in separate processes wait
  instead of failing with SQLITE_BUSY
- Quote table and column names with backticks in generated SQL, so
  reserved words (to, order, group) work and unknown columns error
  instead of matching as string literals
- Tests for queue ops, multi-process claims and reserved-word names

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 16:29:14 +01:00
tbenandClaude Opus 5.5 4e47bd8ce0 Port bun-mariadb schema guard, targetId fix, lazy init and tests
- schema: add --dry-run (sync in a rolled-back transaction) and require
  confirmation (or --yes) before dropping tables or columns; unapproved
  destructive changes are refused
- only rebuild tables whose CREATE TABLE statement changed
- always AND targetId with the query, regardless of searchOperator
- empty IN / NOT IN lists become 1 = 0 / 1 = 1
- initialize lazily on first call so importing never throws
- read CLI version from package.json, chmod CLI on compile, pin @types/bun
- add SQL generator, value and schema guard tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 03:00:29 +01:00
tbenandClaude Opus 5.5 66f73c4228 Fix SQL injection, schema-sync data loss, and backup safety
Security:
- select: bind parameters instead of mysql.format (backslash escaping
  allowed injection on SQLite); drop the mysql dependency
- validate all interpolated identifiers, limit/offset/page, order
  strategy, operators, join types and raw equalities (new sql-safe.ts)
- quote identifiers and bind values in schema manager DDL/queries

Data loss:
- schema sync runs with foreign keys off inside a transaction, with
  foreign_key_check before commit (DROP TABLE no longer cascades)
- parentTableName tables: stop mutating the parent schema and copy
  inherited columns on rebuild
- keep column data on type changes (match columns by name)
- backups and schema snapshots use VACUUM INTO (includes WAL data);
  restore closes the DB, clears -wal/-shm, and swaps atomically
- backup listing/trimming only touches <db_name>-<timestamp> files

Correctness:
- update/delete use the generator's WHERE clause instead of a regex
- keep 0/""/false values; booleans stored as 0/1
- IN/NOT IN and BETWEEN arrays, NOT LIKE wrapping, AVG, select aliases
- OFFSET without LIMIT, count ignores pagination
- MATCH emits `field MATCH fn(?)` for sqlite-vec
- sql() returns rows for any row-producing statement
- targetId no longer mutates the caller's query
- init throws instead of process.exit; CLI reports errors

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 02:06:59 +01:00
tben f3f1c42699 Major version update. Refactor sql generator function. Add core select directives like SUM, MIN, MAX, etc 2026-04-18 07:24:01 +01:00
tben 7b2dc81bbb Bugfix 2026-04-16 15:07:38 +01:00
tben ea8a2eab6b Updates 2026-04-16 15:05:35 +01:00
tben a4aa20baa4 Update sql gen. Add support for raw sql in joins select and regular select sections 2026-04-12 14:15:57 +01:00
tben a57a063f67 Refactor select count strategy. Run the count query together with the normal query 2026-04-12 10:36:32 +01:00
tben 0827cfed11 Pagination Bugfix #3 2026-04-12 08:40:48 +01:00
tben 33f040116d Pagination Bugfix #2 2026-04-12 08:36:21 +01:00
tben eec6ad2785 Pagination Bugfix. 2026-04-12 08:33:29 +01:00
tben dea25b71c2 Add Select pagination 2026-04-12 08:32:00 +01:00
tben 7d320f26ef Update Types 2026-03-22 13:07:38 +01:00
tben 2baf4abdb4 Add Engine V1 2026-03-02 10:24:40 +01:00