diff options
Diffstat (limited to 'server/tests/utils/miscs/sql.ts')
-rw-r--r-- | server/tests/utils/miscs/sql.ts | 38 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | function 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 | |||
19 | function 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 | |||
27 | function 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 | |||
35 | export { | ||
36 | setVideoField, | ||
37 | setActorField | ||
38 | } | ||