Ocelot-Social/backend/src/db/reset-with-migrations.ts
Ulf Gebhardt b464a380ca
refactor(backend): lint @typescript-eslint/recommended-requiring-type-checking (#8407)
* lint @typescript-eslint/recommended

* lint @typescript-eslint/recommended-requiring-type-checking

fix type not detected locally due to wierd uuid typings

missing save

error not reported locally

---------

Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com>
2025-04-21 10:32:44 +00:00

23 lines
857 B
TypeScript

/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-floating-promises */
/* eslint-disable n/no-process-exit */
import CONFIG from '@config/index'
import { cleanDatabase } from './factories'
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({ withMigrations: true })
console.log('Successfully deleted all nodes and relations including!') // eslint-disable-line no-console
process.exit(0)
// eslint-disable-next-line no-catch-all/no-catch-all
} 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)
}
})()