aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-18 12:00:49 +0200
committerChocobozzz <me@florianbigard.com>2018-09-19 09:54:37 +0200
commit627621c1e8d37c33f7b3dd59f4c8907b12c630bc (patch)
tree007e7118f482c543d3898b222b62c185fda4fd2b /scripts
parente972e046dbe9b499944c4fab9220eee13e31ac1b (diff)
downloadPeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.gz
PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.tar.zst
PeerTube-627621c1e8d37c33f7b3dd59f4c8907b12c630bc.zip
Optimize SQL requests of watch page API endpoints
Diffstat (limited to 'scripts')
-rw-r--r--scripts/create-import-video-file-job.ts2
-rwxr-xr-xscripts/create-transcoding-job.ts2
-rwxr-xr-xscripts/prune-storage.ts2
3 files changed, 3 insertions, 3 deletions
diff --git a/scripts/create-import-video-file-job.ts b/scripts/create-import-video-file-job.ts
index 2b636014a..c8c6c6429 100644
--- a/scripts/create-import-video-file-job.ts
+++ b/scripts/create-import-video-file-job.ts
@@ -25,7 +25,7 @@ run()
25async function run () { 25async function run () {
26 await initDatabaseModels(true) 26 await initDatabaseModels(true)
27 27
28 const video = await VideoModel.loadByUUID(program['video']) 28 const video = await VideoModel.loadByUUIDWithFile(program['video'])
29 if (!video) throw new Error('Video not found.') 29 if (!video) throw new Error('Video not found.')
30 if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.') 30 if (video.isOwned() === false) throw new Error('Cannot import files of a non owned video.')
31 31
diff --git a/scripts/create-transcoding-job.ts b/scripts/create-transcoding-job.ts
index 3ea30f98e..7e5b687bb 100755
--- a/scripts/create-transcoding-job.ts
+++ b/scripts/create-transcoding-job.ts
@@ -28,7 +28,7 @@ run()
28async function run () { 28async function run () {
29 await initDatabaseModels(true) 29 await initDatabaseModels(true)
30 30
31 const video = await VideoModel.loadByUUID(program['video']) 31 const video = await VideoModel.loadByUUIDWithFile(program['video'])
32 if (!video) throw new Error('Video not found.') 32 if (!video) throw new Error('Video not found.')
33 33
34 const dataInput = { 34 const dataInput = {
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index 572283868..b00f20934 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -56,7 +56,7 @@ async function pruneDirectory (directory: string) {
56 const uuid = getUUIDFromFilename(file) 56 const uuid = getUUIDFromFilename(file)
57 let video: VideoModel 57 let video: VideoModel
58 58
59 if (uuid) video = await VideoModel.loadByUUID(uuid) 59 if (uuid) video = await VideoModel.loadByUUIDWithFile(uuid)
60 60
61 if (!uuid || !video) toDelete.push(join(directory, file)) 61 if (!uuid || !video) toDelete.push(join(directory, file))
62 } 62 }