aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-18 17:44:04 +0100
committerChocobozzz <me@florianbigard.com>2018-01-18 17:44:04 +0100
commit3e5002477a7643b79aae98ce5e507a7aced6cb8f (patch)
tree03d08a389dd132fcb3e6d3a6561224931fd6418e
parent2c897999fe877c52c8f7458d8bbff6c9367b6587 (diff)
downloadPeerTube-3e5002477a7643b79aae98ce5e507a7aced6cb8f.tar.gz
PeerTube-3e5002477a7643b79aae98ce5e507a7aced6cb8f.tar.zst
PeerTube-3e5002477a7643b79aae98ce5e507a7aced6cb8f.zip
Video get SQL optimization
-rw-r--r--server/models/video/video.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 7af68b20b..71e37e147 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -127,22 +127,30 @@ enum ScopeNames {
127 attributes: { 127 attributes: {
128 exclude: [ 'privateKey', 'publicKey' ] 128 exclude: [ 'privateKey', 'publicKey' ]
129 }, 129 },
130 model: () => ActorModel, 130 model: () => ActorModel.unscoped(),
131 required: true 131 required: true,
132 include: [
133 {
134 attributes: [ 'host' ],
135 model: () => ServerModel.unscoped(),
136 required: false
137 }
138 ]
132 }, 139 },
133 { 140 {
134 model: () => AccountModel, 141 model: () => AccountModel.unscoped(),
135 required: true, 142 required: true,
136 include: [ 143 include: [
137 { 144 {
138 model: () => ActorModel, 145 model: () => ActorModel.unscoped(),
139 attributes: { 146 attributes: {
140 exclude: [ 'privateKey', 'publicKey' ] 147 exclude: [ 'privateKey', 'publicKey' ]
141 }, 148 },
142 required: true, 149 required: true,
143 include: [ 150 include: [
144 { 151 {
145 model: () => ServerModel, 152 attributes: [ 'host' ],
153 model: () => ServerModel.unscoped(),
146 required: false 154 required: false
147 } 155 }
148 ] 156 ]