mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
18 lines
594 B
JavaScript
18 lines
594 B
JavaScript
import { cleanDatabase } from '../db/factories'
|
|
import CONFIG from '../config'
|
|
|
|
if (CONFIG.PRODUCTION && !CONFIG.PRODUCTION_DB_CLEAN_ALLOW) {
|
|
throw new Error(`You cannot clean the database in a non-staging and real production environment!`)
|
|
}
|
|
|
|
;(async function () {
|
|
try {
|
|
await cleanDatabase()
|
|
console.log('Successfully deleted all nodes and relations!') // eslint-disable-line no-console
|
|
process.exit(0)
|
|
} catch (err) {
|
|
console.log(`Error occurred deleting the nodes and relations (reset the db)\n\n${err}`) // eslint-disable-line no-console
|
|
process.exit(1)
|
|
}
|
|
})()
|