Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add script to export compliance_checks table #51

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ dist


# CUSTOM
IGNORE/
IGNORE/
output
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"db:migrate": "knex migrate:latest",
"db:rollback": "knex migrate:rollback",
"db:generate-schema": "docker-compose run schema-dump",
"db:export-checks": "node scripts/export-checks.js",
"db:seed": "knex seed:run"
},
"keywords": [],
Expand Down
12 changes: 12 additions & 0 deletions scripts/export-checks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { writeFileSync } = require('fs')
const { getConfig } = require('../src/config')
const { dbSettings } = getConfig()
const knex = require('knex')(dbSettings)
const { join } = require('path')

;(async () => {
const checks = await knex('compliance_checks').select()
writeFileSync(join(process.cwd(), 'output', 'checks.json'), JSON.stringify(checks, null, 2))
console.log('Checks exported to checks.json')
await knex.destroy()
})()
Loading