diff --git a/packages/helium-vote-service/src/repo.ts b/packages/helium-vote-service/src/repo.ts index 173f8974d..6a95bd204 100644 --- a/packages/helium-vote-service/src/repo.ts +++ b/packages/helium-vote-service/src/repo.ts @@ -28,6 +28,16 @@ export const readProxiesAndUpsert = async () => { "utf-8" ); const proxies = JSON.parse(proxiesJson); + const existingProxiesNotInRepo = await Proxy.findAll({ + where: { + name: { + [Op.notIn]: proxies.map((proxy) => proxy.name), + }, + }, + }); + for (const proxy of existingProxiesNotInRepo) { + await proxy.destroy(); + } for (const proxy of proxies) { const existingProxy = await Proxy.findOne({ where: {