mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-11-25 18:20:31 -06:00
27 lines
718 B
TypeScript
27 lines
718 B
TypeScript
import * as Promise from 'bluebird'
|
|
import * as rimraf from 'rimraf'
|
|
import { CONFIG, initDatabaseModels, sequelizeTypescript } from '../../../server/initializers'
|
|
|
|
initDatabaseModels(true)
|
|
.then(() => {
|
|
return sequelizeTypescript.drop()
|
|
})
|
|
.then(() => {
|
|
console.info('Tables of %s deleted.', CONFIG.DATABASE.DBNAME)
|
|
|
|
const STORAGE = CONFIG.STORAGE
|
|
Promise.mapSeries(Object.keys(STORAGE), storage => {
|
|
const storageDir = STORAGE[storage]
|
|
|
|
return new Promise((res, rej) => {
|
|
rimraf(storageDir, err => {
|
|
if (err) return rej(err)
|
|
|
|
console.info('%s deleted.', storageDir)
|
|
return res()
|
|
})
|
|
})
|
|
})
|
|
.then(() => process.exit(0))
|
|
})
|