aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/miscs/sql.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-12-07 16:09:57 +0100
committerChocobozzz <me@florianbigard.com>2018-12-07 16:25:29 +0100
commit2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f (patch)
tree998a0af6923475c85eb8e97ca1d30afb42655263 /server/tests/utils/miscs/sql.ts
parent4b49385892b25aea5aa9e605fbcb66074bcb49b0 (diff)
parent35adc403b7eed6d1309bbce901268a76dd01b6ef (diff)
downloadPeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.gz
PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.zst
PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.zip
Merge branch 'move-utils-to-shared' of https://github.com/buoyantair/PeerTube into buoyantair-move-utils-to-shared
Diffstat (limited to 'server/tests/utils/miscs/sql.ts')
-rw-r--r--server/tests/utils/miscs/sql.ts38
1 files changed, 0 insertions, 38 deletions
diff --git a/server/tests/utils/miscs/sql.ts b/server/tests/utils/miscs/sql.ts
deleted file mode 100644
index 027f78131..000000000
--- a/server/tests/utils/miscs/sql.ts
+++ /dev/null
@@ -1,38 +0,0 @@
1import * as Sequelize from 'sequelize'
2
3function getSequelize (serverNumber: number) {
4 const dbname = 'peertube_test' + serverNumber
5 const username = 'peertube'
6 const password = 'peertube'
7 const host = 'localhost'
8 const port = 5432
9
10 return new Sequelize(dbname, username, password, {
11 dialect: 'postgres',
12 host,
13 port,
14 operatorsAliases: false,
15 logging: false
16 })
17}
18
19function setActorField (serverNumber: number, to: string, field: string, value: string) {
20 const seq = getSequelize(serverNumber)
21
22 const options = { type: Sequelize.QueryTypes.UPDATE }
23
24 return seq.query(`UPDATE actor SET "${field}" = '${value}' WHERE url = '${to}'`, options)
25}
26
27function setVideoField (serverNumber: number, uuid: string, field: string, value: string) {
28 const seq = getSequelize(serverNumber)
29
30 const options = { type: Sequelize.QueryTypes.UPDATE }
31
32 return seq.query(`UPDATE video SET "${field}" = '${value}' WHERE uuid = '${uuid}'`, options)
33}
34
35export {
36 setVideoField,
37 setActorField
38}