aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0590-trackers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-18 10:15:11 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-18 13:38:09 +0100
commitd9a2a03196275065c28f4a0b7d4d7bc9992d77a1 (patch)
tree14579db95cd07506bf3d8e5c0af3ef1630e8700c /server/initializers/migrations/0590-trackers.ts
parent2451916e45420fedf556913ce121f3964c4b57d6 (diff)
downloadPeerTube-d9a2a03196275065c28f4a0b7d4d7bc9992d77a1.tar.gz
PeerTube-d9a2a03196275065c28f4a0b7d4d7bc9992d77a1.tar.zst
PeerTube-d9a2a03196275065c28f4a0b7d4d7bc9992d77a1.zip
Don't guess remote tracker URL
Diffstat (limited to 'server/initializers/migrations/0590-trackers.ts')
-rw-r--r--server/initializers/migrations/0590-trackers.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/server/initializers/migrations/0590-trackers.ts b/server/initializers/migrations/0590-trackers.ts
new file mode 100644
index 000000000..47b9022a3
--- /dev/null
+++ b/server/initializers/migrations/0590-trackers.ts
@@ -0,0 +1,44 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7 db: any
8}): Promise<void> {
9 {
10 const query = `CREATE TABLE IF NOT EXISTS "tracker" (
11 "id" serial,
12 "url" 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 await utils.sequelize.query(query)
19 }
20
21 {
22 const query = `CREATE TABLE IF NOT EXISTS "videoTracker" (
23 "videoId" integer REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
24 "trackerId" integer REFERENCES "tracker" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
25 "createdAt" timestamp WITH time zone NOT NULL,
26 "updatedAt" timestamp WITH time zone NOT NULL,
27 UNIQUE ("videoId", "trackerId"),
28 PRIMARY KEY ("videoId", "trackerId")
29 );`
30
31 await utils.sequelize.query(query)
32 }
33
34 await utils.sequelize.query(`CREATE UNIQUE INDEX "tracker_url" ON "tracker" ("url")`)
35}
36
37function down (options) {
38 throw new Error('Not implemented.')
39}
40
41export {
42 up,
43 down
44}