u
This commit is contained in:
@@ -6,7 +6,7 @@ SELECT
|
||||
pairingpin,
|
||||
paired_at AS pairedAt,
|
||||
clientserial AS clientserial,
|
||||
maxknowntombstoneid AS maxknowntombstoneid,
|
||||
maxknownobituaryid AS maxknownobituaryid,
|
||||
root_category_id AS rootCategoryId,
|
||||
sync_root_articles AS syncRootArticles,
|
||||
lastseen_at AS lastseenAt,
|
||||
@@ -25,7 +25,7 @@ SELECT
|
||||
pairingpin,
|
||||
paired_at AS pairedAt,
|
||||
clientserial AS clientserial,
|
||||
maxknowntombstoneid AS maxknowntombstoneid,
|
||||
maxknownobituaryid AS maxknownobituaryid,
|
||||
root_category_id AS rootCategoryId,
|
||||
sync_root_articles AS syncRootArticles,
|
||||
lastseen_at AS lastseenAt,
|
||||
@@ -43,7 +43,7 @@ SELECT
|
||||
pairingpin,
|
||||
paired_at AS pairedAt,
|
||||
clientserial AS clientserial,
|
||||
maxknowntombstoneid AS maxknowntombstoneid,
|
||||
maxknownobituaryid AS maxknownobituaryid,
|
||||
root_category_id AS rootCategoryId,
|
||||
sync_root_articles AS syncRootArticles,
|
||||
lastseen_at AS lastseenAt,
|
||||
@@ -59,14 +59,14 @@ WHERE id = @id
|
||||
`;
|
||||
|
||||
export const CREATE = `
|
||||
INSERT INTO posterminal (company_id, name, token, pairingpin, paired_at, clientserial, maxknowntombstoneid, root_category_id, sync_root_articles, lastseen_at, updated_at)
|
||||
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin, INSERTED.paired_at AS pairedAt, INSERTED.clientserial AS clientserial, INSERTED.maxknowntombstoneid AS maxknowntombstoneid, INSERTED.root_category_id AS rootCategoryId, INSERTED.sync_root_articles AS syncRootArticles, INSERTED.lastseen_at AS lastseenAt, INSERTED.updated_at AS updatedAt
|
||||
VALUES (@companyId, @name, @token, @pairingpin, @pairedAt, @clientserial, @maxknowntombstoneid, @rootCategoryId, @syncRootArticles, @lastseenAt, SYSUTCDATETIME())
|
||||
INSERT INTO posterminal (company_id, name, token, pairingpin, paired_at, clientserial, maxknownobituaryid, root_category_id, sync_root_articles, lastseen_at, updated_at)
|
||||
OUTPUT INSERTED.id, INSERTED.name, INSERTED.token, INSERTED.pairingpin, INSERTED.paired_at AS pairedAt, INSERTED.clientserial AS clientserial, INSERTED.maxknownobituaryid AS maxknownobituaryid, INSERTED.root_category_id AS rootCategoryId, INSERTED.sync_root_articles AS syncRootArticles, INSERTED.lastseen_at AS lastseenAt, INSERTED.updated_at AS updatedAt
|
||||
VALUES (@companyId, @name, @token, @pairingpin, @pairedAt, @clientserial, @maxknownobituaryid, @rootCategoryId, @syncRootArticles, @lastseenAt, SYSUTCDATETIME())
|
||||
`;
|
||||
|
||||
export const UPDATE = `
|
||||
UPDATE posterminal
|
||||
SET name = @name, token = @token, pairingpin = @pairingpin, paired_at = @pairedAt, clientserial = @clientserial, maxknowntombstoneid = @maxknowntombstoneid, root_category_id = @rootCategoryId, sync_root_articles = @syncRootArticles, lastseen_at = @lastseenAt, updated_at = SYSUTCDATETIME()
|
||||
SET name = @name, token = @token, pairingpin = @pairingpin, paired_at = @pairedAt, clientserial = @clientserial, maxknownobituaryid = @maxknownobituaryid, root_category_id = @rootCategoryId, sync_root_articles = @syncRootArticles, lastseen_at = @lastseenAt, updated_at = SYSUTCDATETIME()
|
||||
WHERE id = @id AND company_id = @companyId
|
||||
`;
|
||||
|
||||
@@ -76,9 +76,9 @@ SET lastseen_at = SYSUTCDATETIME()
|
||||
WHERE id = @id
|
||||
`;
|
||||
|
||||
export const SET_MAX_KNOWN_TOMBSTONE_ID = `
|
||||
export const SET_MAX_KNOWN_OBITUARY_ID = `
|
||||
UPDATE posterminal
|
||||
SET maxknowntombstoneid = @maxknowntombstoneid
|
||||
SET maxknownobituaryid = @maxknownobituaryid
|
||||
WHERE id = @id
|
||||
`;
|
||||
|
||||
@@ -150,7 +150,7 @@ SELECT
|
||||
pairingpin,
|
||||
paired_at AS pairedAt,
|
||||
clientserial AS clientserial,
|
||||
maxknowntombstoneid AS maxknowntombstoneid,
|
||||
maxknownobituaryid AS maxknownobituaryid,
|
||||
root_category_id AS rootCategoryId,
|
||||
sync_root_articles AS syncRootArticles,
|
||||
lastseen_at AS lastseenAt,
|
||||
@@ -483,8 +483,8 @@ WHERE pr.minmultiplier = 1
|
||||
GROUP BY pr.article_id, pr.customergroup_id
|
||||
`;
|
||||
|
||||
export const RECORD_TOMBSTONE = `
|
||||
INSERT INTO posterminaltombstone (posterminal_id, entity_type, entity_id)
|
||||
export const RECORD_OBITUARY = `
|
||||
INSERT INTO posterminalobituary (posterminal_id, entity_type, entity_id)
|
||||
SELECT pt.id, @entityType, @entityId
|
||||
FROM posterminal pt
|
||||
WHERE pt.company_id = @companyId AND pt.token IS NOT NULL
|
||||
@@ -492,7 +492,7 @@ WHERE pt.company_id = @companyId AND pt.token IS NOT NULL
|
||||
|
||||
export const COUNT_DELETED_ENTITIES = `
|
||||
SELECT COUNT(*) AS count
|
||||
FROM posterminaltombstone
|
||||
FROM posterminalobituary
|
||||
WHERE posterminal_id = @posterminalId AND id > @cursor
|
||||
`;
|
||||
|
||||
@@ -501,7 +501,7 @@ SELECT TOP (@limit)
|
||||
id,
|
||||
entity_type AS entityType,
|
||||
entity_id AS entityId
|
||||
FROM posterminaltombstone
|
||||
FROM posterminalobituary
|
||||
WHERE posterminal_id = @posterminalId AND id > @cursor
|
||||
ORDER BY id ASC
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user