aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-23 20:13:30 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commit8cd72bd37724054f8942f2fefc7aa2e60eca74cf (patch)
treef2ed8da2a5a804286335156283659e9eaec5291a /server/models/account
parent5bcfd02974389e1a131496d22f4321a79bed0fbb (diff)
downloadPeerTube-8cd72bd37724054f8942f2fefc7aa2e60eca74cf.tar.gz
PeerTube-8cd72bd37724054f8942f2fefc7aa2e60eca74cf.tar.zst
PeerTube-8cd72bd37724054f8942f2fefc7aa2e60eca74cf.zip
Optimize SQL queries
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/account-video-rate.ts9
-rw-r--r--server/models/account/account.ts14
2 files changed, 22 insertions, 1 deletions
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts
index 9c19ec748..c99e32012 100644
--- a/server/models/account/account-video-rate.ts
+++ b/server/models/account/account-video-rate.ts
@@ -17,6 +17,15 @@ import { ActorModel } from '../activitypub/actor'
17 { 17 {
18 fields: [ 'videoId', 'accountId' ], 18 fields: [ 'videoId', 'accountId' ],
19 unique: true 19 unique: true
20 },
21 {
22 fields: [ 'videoId' ]
23 },
24 {
25 fields: [ 'accountId' ]
26 },
27 {
28 fields: [ 'videoId', 'type' ]
20 } 29 }
21 ] 30 ]
22}) 31})
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 3ff59887d..2eed66fc2 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -46,7 +46,19 @@ import { UserModel } from './user'
46 ] 46 ]
47}) 47})
48@Table({ 48@Table({
49 tableName: 'account' 49 tableName: 'account',
50 indexes: [
51 {
52 fields: [ 'actorId' ],
53 unique: true
54 },
55 {
56 fields: [ 'applicationId' ]
57 },
58 {
59 fields: [ 'userId' ]
60 }
61 ]
50}) 62})
51export class AccountModel extends Model<AccountModel> { 63export class AccountModel extends Model<AccountModel> {
52 64