]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - scripts/danger/clean/cleaner.ts
Return to sequelize@4.0.0-2 (makes tests fail)
[github/Chocobozzz/PeerTube.git] / scripts / danger / clean / cleaner.ts
CommitLineData
1840c2f7
C
1import * as eachSeries from 'async/eachSeries'
2import * as rimraf from 'rimraf'
82221ac9 3
1840c2f7
C
4import { CONFIG } from '../../../server/initializers/constants'
5import { database as db } from '../../../server/initializers/database'
82221ac9 6
dd601993
C
7db.init(true, function () {
8 db.sequelize.drop().asCallback(function (err) {
9 if (err) throw err
82221ac9 10
1840c2f7 11 console.info('Tables of %s deleted.', CONFIG.DATABASE.DBNAME)
82221ac9 12
1840c2f7 13 const STORAGE = CONFIG.STORAGE
00d6a41e 14 eachSeries(Object.keys(STORAGE), function (storage, callbackEach) {
dd601993
C
15 const storageDir = STORAGE[storage]
16
17 rimraf(storageDir, function (err) {
00d6a41e
C
18 console.info('%s deleted.', storageDir)
19 return callbackEach(err)
dd601993 20 })
00d6a41e
C
21 }, function () {
22 process.exit(0)
dd601993 23 })
82221ac9
C
24 })
25})