]>
Commit | Line | Data |
---|---|---|
6fcd19ba | 1 | import * as Promise from 'bluebird' |
3fd3ab2d | 2 | import * as rimraf from 'rimraf' |
91fea9fc | 3 | import { CONFIG, initDatabaseModels, sequelizeTypescript } from '../../../server/initializers' |
82221ac9 | 4 | |
91fea9fc | 5 | initDatabaseModels(true) |
6fcd19ba | 6 | .then(() => { |
3fd3ab2d | 7 | return sequelizeTypescript.drop() |
6fcd19ba C |
8 | }) |
9 | .then(() => { | |
1840c2f7 | 10 | console.info('Tables of %s deleted.', CONFIG.DATABASE.DBNAME) |
82221ac9 | 11 | |
1840c2f7 | 12 | const STORAGE = CONFIG.STORAGE |
6fcd19ba | 13 | Promise.mapSeries(Object.keys(STORAGE), storage => { |
dd601993 C |
14 | const storageDir = STORAGE[storage] |
15 | ||
6fcd19ba | 16 | return new Promise((res, rej) => { |
fdbda9e3 | 17 | rimraf(storageDir, err => { |
6fcd19ba C |
18 | if (err) return rej(err) |
19 | ||
20 | console.info('%s deleted.', storageDir) | |
21 | return res() | |
22 | }) | |
dd601993 C |
23 | }) |
24 | }) | |
6fcd19ba | 25 | .then(() => process.exit(0)) |
82221ac9 | 26 | }) |