sqlite
This commit is contained in:
40
TODO.md
40
TODO.md
@@ -9,35 +9,35 @@ Replace raw `pool` usage in `src/store/**` with `provider.query()` /
|
||||
`provider.transaction()` / `provider.exec()` and the normalized result shape
|
||||
(`{ rows, rowsAffected, insertId }` instead of `recordset` / `rowsAffected[]`).
|
||||
For every module:
|
||||
- [ ] `pool.request().input(...).query(SQL)` → `provider.query(SQL, params)`
|
||||
- [ ] `pool.transaction(); begin; commit; catch rollback` → `provider.transaction(async (tx) => { ... })`
|
||||
- [ ] `result.recordset` → `result.rows`; `result.rowsAffected[0]` → `result.rowsAffected`
|
||||
- [ ] `request.js` helper (`(tx ?? pool).request()`) becomes obsolete — delete when unused
|
||||
- [x] `pool.request().input(...).query(SQL)` → `provider.query(SQL, params)`
|
||||
- [x] `pool.transaction(); begin; commit; catch rollback` → `provider.transaction(async (tx) => { ... })`
|
||||
- [x] `result.recordset` → `result.rows`; `result.rowsAffected[0]` → `result.rowsAffected`
|
||||
- [x] `request.js` helper (`(tx ?? pool).request()`) becomes obsolete — deleted
|
||||
- [x] `src/store/runner.js` bridges mixed call sites: converted modules accept a
|
||||
provider runner *or* a legacy mssql Transaction/`pool` (wrapped on the fly)
|
||||
so partially converted callers keep working
|
||||
- [ ] `recordset[0].id` after `OUTPUT INSERTED.id` → keep, but prefer `insertId` where trivial
|
||||
- [x] `recordset[0].id` after `OUTPUT INSERTED.id` → keep, but prefer `insertId` where trivial
|
||||
|
||||
Conversion order (bottom-up by dependency):
|
||||
- [x] `lang`, `tax` (leaf helpers, used by company create)
|
||||
- [x] `google_auth`
|
||||
- [ ] `companyuser` (resolveCompanyAccess / resolveSelectedCompanyAccess first)
|
||||
- [ ] `company`, `companysetting`
|
||||
- [ ] `customergroup`, `entity`, `entityaddress`, `entitycontact`, `entityhistory`
|
||||
- [ ] `unit` (incl. `ensureDefault`), `brand`, `supplier`
|
||||
- [ ] `numbers` (see §2 — stored procs!)
|
||||
- [ ] `category` (recursive CTEs!)
|
||||
- [ ] `article` + articletext/articlepic/articleean/price/articlehistory
|
||||
- [ ] `articlesupplier`
|
||||
- [ ] `quote`, `order`, `delivery` (shared manifest helpers: `manifestLines`, `manifestDoc`, `manifestattachment`)
|
||||
- [ ] `posterminal`, `pic`
|
||||
- [ ] `initialize.js`, `purge.js` final wiring (drop `provider.pool` fallback from `index.js`)
|
||||
- [ ] Delete `src/store/request.js` once no module uses it
|
||||
- [x] `companyuser` (resolveCompanyAccess / resolveSelectedCompanyAccess first)
|
||||
- [x] `company`, `companysetting`
|
||||
- [x] `customergroup`, `entity`, `entityaddress`, `entitycontact`, `entityhistory`
|
||||
- [x] `unit` (incl. `ensureDefault`), `brand`, `supplier`
|
||||
- [x] `numbers` (see §2 — stored procs!)
|
||||
- [x] `category` (recursive CTEs!)
|
||||
- [x] `article` + articletext/articlepic/articleean/price/articlehistory
|
||||
- [x] `articlesupplier`
|
||||
- [x] `quote`, `order`, `delivery` (shared manifest helpers: `manifestLines`, `manifestDoc`, `manifestattachment`)
|
||||
- [x] `posterminal`, `pic`
|
||||
- [x] `initialize.js`, `purge.js` final wiring (drop `provider.pool` fallback from `index.js`)
|
||||
- [x] Delete `src/store/request.js` once no module uses it
|
||||
|
||||
## 2. Replace MSSQL stored procedures (blocker for SQLite)
|
||||
- [ ] `numbers.nextNumber` uses proc `getnextnumberwithprefixandpadding` (output param)
|
||||
- [ ] `numbers.peekNumber` uses proc `peeknextnumberwithprefixandpadding` (output param)
|
||||
- [ ] Implement both in plain JS inside the store layer: `SELECT next/prefix/padding`,
|
||||
- [x] `numbers.nextNumber` uses proc `getnextnumberwithprefixandpadding` (output param)
|
||||
- [x] `numbers.peekNumber` uses proc `peeknextnumberwithprefixandpadding` (output param)
|
||||
- [x] Implement both in plain JS inside the store layer: `SELECT next/prefix/padding`,
|
||||
compute `prefix + padded next`, `UPDATE numbers SET next = next + 1 WHERE ...`.
|
||||
Must stay atomic: use `provider.transaction()` with row locking semantics
|
||||
(MSSQL: `WITH (UPDLOCK, ROWLOCK)` in the SELECT; SQLite: within its write tx).
|
||||
|
||||
Reference in New Issue
Block a user