aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/oauth-client.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-client.js
parent67bf9b96bbcd92b069fe86d9223fe0f8b9c6e677 (diff)
downloadPeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.tar.gz
PeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.tar.zst
PeerTube-319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1.zip
Server: Add postgresql indexes
Diffstat (limited to 'server/models/oauth-client.js')
-rw-r--r--server/models/oauth-client.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/server/models/oauth-client.js b/server/models/oauth-client.js
index b56838d4c..758c4cf2f 100644
--- a/server/models/oauth-client.js
+++ b/server/models/oauth-client.js
@@ -19,9 +19,17 @@ module.exports = function (sequelize, DataTypes) {
19 } 19 }
20 }, 20 },
21 { 21 {
22 indexes: [
23 {
24 fields: [ 'clientId' ],
25 unique: true
26 },
27 {
28 fields: [ 'clientId', 'clientSecret' ],
29 unique: true
30 }
31 ],
22 classMethods: { 32 classMethods: {
23 associate,
24
25 getByIdAndSecret, 33 getByIdAndSecret,
26 list, 34 list,
27 loadFirstClient 35 loadFirstClient
@@ -34,16 +42,6 @@ module.exports = function (sequelize, DataTypes) {
34 42
35// --------------------------------------------------------------------------- 43// ---------------------------------------------------------------------------
36 44
37function associate (models) {
38 this.hasMany(models.OAuthToken, {
39 foreignKey: {
40 name: 'oAuthClientId',
41 allowNull: false
42 },
43 onDelete: 'cascade'
44 })
45}
46
47function list (callback) { 45function list (callback) {
48 return this.findAll().asCallback(callback) 46 return this.findAll().asCallback(callback)
49} 47}