refactor: introduce database provider abstraction, isolate MSSQL layer
- Add provider contract (src/providers/provider.js): query() -> {rows,
rowsAffected, insertId}, callback transaction(fn), exec() for stored
procs, initialize/purge lifecycle
- Add MssqlProvider (src/providers/mssql/index.js) wrapping an mssql
ConnectionPool with normalized results, tx commit/rollback and
constraint-error classifiers (unique 2627/2601, FK 547)
- LibDashStore constructor now takes a provider instead of a pool
(breaking); adds LibDashStore.create() async factory; keeps pool as
transitional bridge until store modules are converted (see TODO.md)
- Move MSSQL-specific code into the provider: src/sql/* ->
src/providers/mssql/queries/*, src/schema.js ->
src/providers/mssql/schema.js, purge SQL -> purgeSql.js
- Update scripts, generate-schema-graph.js and package.json exports
(./providers/mssql, ./providers/provider)
- Add TODO.md with the remaining provider/SQLite migration plan
No SQL or behavioral changes.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DELETE_BY_COMPANY_AND_SI } from '../../sql/unit.js';
|
||||
import { DELETE_BY_COMPANY_AND_SI } from '../../providers/mssql/queries/unit.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
|
||||
export default function del(pool) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CREATE, GET_BY_SI } from '../../sql/unit.js';
|
||||
import { CREATE, GET_BY_SI } from '../../providers/mssql/queries/unit.js';
|
||||
import {
|
||||
CREATE as CREATE_UNITTEXT,
|
||||
GET_BY_UNIT_AND_LANGUAGE,
|
||||
} from '../../sql/unittext.js';
|
||||
} from '../../providers/mssql/queries/unittext.js';
|
||||
import request from '../request.js';
|
||||
|
||||
const DEFAULT_SI = 'pc';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { LIST_BY_COMPANY } from '../../sql/unit.js';
|
||||
import { LIST_BY_COMPANY } from '../../providers/mssql/queries/unit.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import shapeUnit from './shapeUnit.js';
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@ import {
|
||||
GET_BY_SI,
|
||||
GET_FULL_BY_SI,
|
||||
UPDATE_BY_SI,
|
||||
} from '../../sql/unit.js';
|
||||
} from '../../providers/mssql/queries/unit.js';
|
||||
import {
|
||||
CREATE as CREATE_UNITTEXT,
|
||||
GET_BY_UNIT_AND_LANGUAGE,
|
||||
UPDATE_BY_UNIT_AND_LANGUAGE,
|
||||
} from '../../sql/unittext.js';
|
||||
} from '../../providers/mssql/queries/unittext.js';
|
||||
import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyAccess.js';
|
||||
import request from '../request.js';
|
||||
import shapeUnit from './shapeUnit.js';
|
||||
|
||||
Reference in New Issue
Block a user