providerrefactor part1
This commit is contained in:
21
src/providers/sqlite3/queries/numbers.js
Normal file
21
src/providers/sqlite3/queries/numbers.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import * as source from '../../mssql/queries/numbers.js';
|
||||
import { translateQueries } from './translate.js';
|
||||
|
||||
const queries = translateQueries(source, 'numbers');
|
||||
export const { GET_BY_COMPANY_AND_ID, LIST_BY_COMPANY, UPDATE_BY_COMPANY_AND_ID } = queries;
|
||||
|
||||
export const ENSURE_TYPE = `
|
||||
INSERT INTO numbers (company_id, "type")
|
||||
VALUES (@companyId, @type)
|
||||
ON CONFLICT (company_id, "type") DO NOTHING
|
||||
`;
|
||||
|
||||
export const GET_FOR_UPDATE = `
|
||||
SELECT id, "type", prefix, padding, "next"
|
||||
FROM numbers
|
||||
WHERE company_id = @companyId AND "type" = @type
|
||||
`;
|
||||
|
||||
export const INCREMENT = `
|
||||
UPDATE numbers SET "next" = "next" + 1 WHERE id = @id
|
||||
`;
|
||||
Reference in New Issue
Block a user