Original code in the script -
async function resetTableSequence(destination) { if (isPGSQL) { const hasId = await dbV4.schema.hasColumn(destination, "id");
if (hasId) { const seq = `${destination.slice(0, 56)}_id_seq`;
await dbV4.raw(
`SELECT SETVAL ('${seq}', (SELECT MAX(id) + 1 FROM '${destination}'))`
);
} } }
My modifications to the code -
async function resetTableSequence(destination) { if (isPGSQL) { const hasId = await dbV4.schema.hasColumn(destination, "id");
if (hasId) { const seq = `${destination.slice(0, 56)}_id_seq`;
await dbV4.raw(
`SELECT SETVAL ('${seq}', (SELECT MAX(id) + 1 FROM ${destination}))`
);
} } }
I changed ‘${destination}’ to ${destination}.
It worked! It solved my problem!