aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/miscs/sql.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-11 16:54:52 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 18:18:41 +0100
commit32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf (patch)
tree1db53245688a6b7839cab00f9d65e6c1c1774b00 /shared/extra-utils/miscs/sql.ts
parent3fbc6974334ca58c068f0f9def0b0a40db2a6de1 (diff)
downloadPeerTube-32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf.tar.gz
PeerTube-32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf.tar.zst
PeerTube-32a18cbf33a7cdbbe3d4885d32e4b67e19cdc1cf.zip
Add new plugin/peertube version notifs
Diffstat (limited to 'shared/extra-utils/miscs/sql.ts')
-rw-r--r--shared/extra-utils/miscs/sql.ts13
1 files changed, 11 insertions, 2 deletions
diff --git a/shared/extra-utils/miscs/sql.ts b/shared/extra-utils/miscs/sql.ts
index 740f0c2d6..345e5bc16 100644
--- a/shared/extra-utils/miscs/sql.ts
+++ b/shared/extra-utils/miscs/sql.ts
@@ -106,12 +106,20 @@ async function closeAllSequelize (servers: ServerInfo[]) {
106 } 106 }
107} 107}
108 108
109function setPluginVersion (internalServerNumber: number, pluginName: string, newVersion: string) { 109function setPluginField (internalServerNumber: number, pluginName: string, field: string, value: string) {
110 const seq = getSequelize(internalServerNumber) 110 const seq = getSequelize(internalServerNumber)
111 111
112 const options = { type: QueryTypes.UPDATE } 112 const options = { type: QueryTypes.UPDATE }
113 113
114 return seq.query(`UPDATE "plugin" SET "version" = '${newVersion}' WHERE "name" = '${pluginName}'`, options) 114 return seq.query(`UPDATE "plugin" SET "${field}" = '${value}' WHERE "name" = '${pluginName}'`, options)
115}
116
117function setPluginVersion (internalServerNumber: number, pluginName: string, newVersion: string) {
118 return setPluginField(internalServerNumber, pluginName, 'version', newVersion)
119}
120
121function setPluginLatestVersion (internalServerNumber: number, pluginName: string, newVersion: string) {
122 return setPluginField(internalServerNumber, pluginName, 'latestVersion', newVersion)
115} 123}
116 124
117function setActorFollowScores (internalServerNumber: number, newScore: number) { 125function setActorFollowScores (internalServerNumber: number, newScore: number) {
@@ -128,6 +136,7 @@ export {
128 setActorField, 136 setActorField,
129 countVideoViewsOf, 137 countVideoViewsOf,
130 setPluginVersion, 138 setPluginVersion,
139 setPluginLatestVersion,
131 selectQuery, 140 selectQuery,
132 deleteAll, 141 deleteAll,
133 updateQuery, 142 updateQuery,