aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-token.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-29 09:33:28 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-29 10:04:39 +0100
commit319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1 (patch)
tree33735d94f0f928e80486f82bcc21fdf233b5b445 /server/models/oauth-token.js
parent67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677 (diff)
downloadPeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.tar.gz
PeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.tar.zst
PeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.zip
Server: Add postgresql indexes
Diffstat (limited to 'server/models/oauth-token.js')
-rw-r--r--server/models/oauth-token.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/models/oauth-token.js b/server/models/oauth-token.js
index f8de4e916..68e7c9ff7 100644
--- a/server/models/oauth-token.js
+++ b/server/models/oauth-token.js
@@ -25,6 +25,22 @@ module.exports = function (sequelize, DataTypes) {
25 } 25 }
26 }, 26 },
27 { 27 {
28 indexes: [
29 {
30 fields: [ 'refreshToken' ],
31 unique: true
32 },
33 {
34 fields: [ 'accessToken' ],
35 unique: true
36 },
37 {
38 fields: [ 'userId' ]
39 },
40 {
41 fields: [ 'oAuthClientId' ]
42 }
43 ],
28 classMethods: { 44 classMethods: {
29 associate, 45 associate,
30 46
@@ -49,6 +65,14 @@ function associate (models) {
49 }, 65 },
50 onDelete: 'cascade' 66 onDelete: 'cascade'
51 }) 67 })
68
69 this.belongsTo(models.OAuthClient, {
70 foreignKey: {
71 name: 'oAuthClientId',
72 allowNull: false
73 },
74 onDelete: 'cascade'
75 })
52} 76}
53 77
54function getByRefreshTokenAndPopulateClient (refreshToken) { 78function getByRefreshTokenAndPopulateClient (refreshToken) {