aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0765-remote-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-04-21 14:55:10 +0200
committerChocobozzz <chocobozzz@cpy.re>2023-05-09 08:57:34 +0200
commit0c9668f77901e7540e2c7045eb0f2974a4842a69 (patch)
tree226d3dd1565b0bb56588897af3b8530e6216e96b /server/initializers/migrations/0765-remote-transcoding.ts
parent6bcb854cdea8688a32240bc5719c7d139806e00b (diff)
downloadPeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.gz
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.tar.zst
PeerTube-0c9668f77901e7540e2c7045eb0f2974a4842a69.zip
Implement remote runner jobs in server
Move ffmpeg functions to @shared
Diffstat (limited to 'server/initializers/migrations/0765-remote-transcoding.ts')
-rw-r--r--server/initializers/migrations/0765-remote-transcoding.ts78
1 files changed, 78 insertions, 0 deletions
diff --git a/server/initializers/migrations/0765-remote-transcoding.ts b/server/initializers/migrations/0765-remote-transcoding.ts
new file mode 100644
index 000000000..40cca03b4
--- /dev/null
+++ b/server/initializers/migrations/0765-remote-transcoding.ts
@@ -0,0 +1,78 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<void> {
8 {
9 const query = `
10 CREATE TABLE IF NOT EXISTS "runnerRegistrationToken"(
11 "id" serial,
12 "registrationToken" varchar(255) NOT NULL,
13 "createdAt" timestamp with time zone NOT NULL,
14 "updatedAt" timestamp with time zone NOT NULL,
15 PRIMARY KEY ("id")
16 );
17 `
18
19 await utils.sequelize.query(query, { transaction : utils.transaction })
20 }
21
22 {
23 const query = `
24 CREATE TABLE IF NOT EXISTS "runner"(
25 "id" serial,
26 "runnerToken" varchar(255) NOT NULL,
27 "name" varchar(255) NOT NULL,
28 "description" varchar(1000),
29 "lastContact" timestamp with time zone NOT NULL,
30 "ip" varchar(255) NOT NULL,
31 "runnerRegistrationTokenId" integer REFERENCES "runnerRegistrationToken"("id") ON DELETE CASCADE ON UPDATE CASCADE,
32 "createdAt" timestamp with time zone NOT NULL,
33 "updatedAt" timestamp with time zone NOT NULL,
34 PRIMARY KEY ("id")
35 );
36 `
37
38 await utils.sequelize.query(query, { transaction : utils.transaction })
39 }
40
41 {
42 const query = `
43 CREATE TABLE IF NOT EXISTS "runnerJob"(
44 "id" serial,
45 "uuid" uuid NOT NULL,
46 "type" varchar(255) NOT NULL,
47 "payload" jsonb NOT NULL,
48 "privatePayload" jsonb NOT NULL,
49 "state" integer NOT NULL,
50 "failures" integer NOT NULL DEFAULT 0,
51 "error" varchar(5000),
52 "priority" integer NOT NULL,
53 "processingJobToken" varchar(255),
54 "progress" integer,
55 "startedAt" timestamp with time zone,
56 "finishedAt" timestamp with time zone,
57 "dependsOnRunnerJobId" integer REFERENCES "runnerJob"("id") ON DELETE CASCADE ON UPDATE CASCADE,
58 "runnerId" integer REFERENCES "runner"("id") ON DELETE SET NULL ON UPDATE CASCADE,
59 "createdAt" timestamp with time zone NOT NULL,
60 "updatedAt" timestamp with time zone NOT NULL,
61 PRIMARY KEY ("id")
62 );
63
64
65 `
66
67 await utils.sequelize.query(query, { transaction : utils.transaction })
68 }
69}
70
71function down (options) {
72 throw new Error('Not implemented.')
73}
74
75export {
76 up,
77 down
78}