갱신 행의 ID를 보존하고 예약턴의 불필요한 시퀀스를 제거한다
This commit is contained in:
1 parent
bc54b157c1
commit
81e101ffef
43 files changed
+587
-113
No files matched your search
@@ -198,6 +198,23 @@ integration('general batch persistence', () => {
|
||||
);
|
||||
});
|
||||
expect(writes).toBe(2);
|
||||
const originalIds = (
|
||||
await db.generalAccessLog.findMany({
|
||||
where: { generalId: { gte: firstId, lte: firstId + GENERAL_UPDATE_BATCH_SIZE } },
|
||||
orderBy: { generalId: 'asc' },
|
||||
})
|
||||
).map((row) => row.id);
|
||||
const sequence = await db.$queryRaw`SELECT last_value FROM general_access_log_id_seq`;
|
||||
await db.$transaction((tx) => persistGeneralAccessScores(tx, updates));
|
||||
expect(
|
||||
(
|
||||
await db.generalAccessLog.findMany({
|
||||
where: { generalId: { gte: firstId, lte: firstId + GENERAL_UPDATE_BATCH_SIZE } },
|
||||
orderBy: { generalId: 'asc' },
|
||||
})
|
||||
).map((row) => row.id)
|
||||
).toEqual(originalIds);
|
||||
expect(await db.$queryRaw`SELECT last_value FROM general_access_log_id_seq`).toEqual(sequence);
|
||||
expect(await db.generalAccessLog.findUniqueOrThrow({ where: { generalId: firstId } })).toMatchObject({
|
||||
userId: 'original-owner',
|
||||
lastRefresh: at,
|
||||
|
||||
Reference in new issue
Block a user