Skip to content

Commit

Permalink
feat: delete option for regex checker
Browse files Browse the repository at this point in the history
  • Loading branch information
paring-chan committed Apr 19, 2023
1 parent 7c4698a commit 91a5045
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bot/findInvalidRules.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ config({ path: '../shared/.env' })

import { PrismaClient } from '@prisma/client'

const argv = process.argv

const db = new PrismaClient()

const ruleElements = await db.ruleElement.findMany()
Expand All @@ -17,5 +19,9 @@ for (const el of ruleElements) {
console.error(e.message)
console.error('element:', el)
console.error('rule:', await db.rule.findUnique({where: {id: el.ruleId}}))

if (argv.includes('--delete')) {
await db.ruleElement.delete({ where: { id: el.id } })
}
}
}

0 comments on commit 91a5045

Please sign in to comment.