Skip to content

Commit

Permalink
feat(sync): change name of updated_at column property to timestampColumn
Browse files Browse the repository at this point in the history
  • Loading branch information
djMax committed Jan 13, 2024
1 parent ba0255e commit 8751bf3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dbs/kysely.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export async function syncTable<
from: T;
to: string;
pk: PK;
updatedCol?: UC;
timestampColumn?: UC;
delaySeconds: number;
},
) {
Expand All @@ -48,7 +48,7 @@ export async function syncTable<
getRows(bookmark, limit) {
type TableWhere = Parameters<typeof baseQuery['where']>;
const pkColumn = spec.pk as unknown as TableWhere[0];
const udColumn = (spec.updatedCol || 'updated_at') as unknown as TableWhere[0];
const udColumn = (spec.timestampColumn || 'updated_at') as unknown as TableWhere[0];
let completeQuery = baseQuery
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.where(udColumn, '<', sql<any>`NOW() - INTERVAL \'1 SECOND\' * ${spec.delaySeconds}`)
Expand Down

0 comments on commit 8751bf3

Please sign in to comment.