u
This commit is contained in:
19
src/providers/mssql/queries/healthcheck.js
Normal file
19
src/providers/mssql/queries/healthcheck.js
Normal file
@@ -0,0 +1,19 @@
|
||||
export const ENSURE_ROW = `
|
||||
IF NOT EXISTS (SELECT 1 FROM healthcheck)
|
||||
BEGIN
|
||||
INSERT INTO healthcheck ([sequence]) VALUES (0);
|
||||
END
|
||||
`;
|
||||
|
||||
export const SELECT_FOR_UPDATE = `
|
||||
SELECT TOP 1 id, [sequence]
|
||||
FROM healthcheck WITH (UPDLOCK, ROWLOCK)
|
||||
ORDER BY id ASC;
|
||||
`;
|
||||
|
||||
export const UPDATE_SEQUENCE = `
|
||||
UPDATE healthcheck
|
||||
SET [sequence] = @sequence,
|
||||
updated_at = SYSUTCDATETIME()
|
||||
WHERE id = @id;
|
||||
`;
|
||||
Reference in New Issue
Block a user