]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - scripts/prune-storage.ts
Fix old DB enum names
[github/Chocobozzz/PeerTube.git] / scripts / prune-storage.ts
index 12d78fdc6d3b5aa4d095440d26707afa879f9f0d..3012bdb94836ec6f343f9c05a29c3b35dae5b10d 100755 (executable)
@@ -1,22 +1,19 @@
-import { registerTSPaths } from '../server/helpers/register-ts-paths'
-registerTSPaths()
-
-import { start, get } from 'prompt'
-import { join, basename } from 'path'
+import { map } from 'bluebird'
+import { readdir, remove, stat } from 'fs-extra'
+import { basename, join } from 'path'
+import { get, start } from 'prompt'
+import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
+import { VideoFileModel } from '@server/models/video/video-file'
+import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
+import { uniqify } from '@shared/core-utils'
+import { ThumbnailType } from '@shared/models'
+import { getUUIDFromFilename } from '../server/helpers/utils'
 import { CONFIG } from '../server/initializers/config'
-import { VideoModel } from '../server/models/video/video'
 import { initDatabaseModels } from '../server/initializers/database'
-import { readdir, remove, stat } from 'fs-extra'
+import { ActorImageModel } from '../server/models/actor/actor-image'
 import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy'
-import { map } from 'bluebird'
-import { getUUIDFromFilename } from '../server/helpers/utils'
 import { ThumbnailModel } from '../server/models/video/thumbnail'
-import { ActorImageModel } from '../server/models/actor/actor-image'
-import { uniq, values } from 'lodash'
-import { ThumbnailType } from '@shared/models'
-import { VideoFileModel } from '@server/models/video/video-file'
-import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
-import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
+import { VideoModel } from '../server/models/video/video'
 
 run()
   .then(() => process.exit(0))
@@ -26,9 +23,9 @@ run()
   })
 
 async function run () {
-  const dirs = values(CONFIG.STORAGE)
+  const dirs = Object.values(CONFIG.STORAGE)
 
-  if (uniq(dirs).length !== dirs.length) {
+  if (uniqify(dirs).length !== dirs.length) {
     console.error('Cannot prune storage because you put multiple storage keys in the same directory.')
     process.exit(0)
   }