aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0730-video-channel-sync.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/server/initializers/migrations/0730-video-channel-sync.ts b/server/initializers/migrations/0730-video-channel-sync.ts
new file mode 100644
index 000000000..a2fe8211f
--- /dev/null
+++ b/server/initializers/migrations/0730-video-channel-sync.ts
@@ -0,0 +1,36 @@
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 const query = `
10 CREATE TABLE IF NOT EXISTS "videoChannelSync" (
11 "id" SERIAL,
12 "externalChannelUrl" VARCHAR(2000) NOT NULL DEFAULT NULL,
13 "videoChannelId" INTEGER NOT NULL REFERENCES "videoChannel" ("id")
14 ON DELETE CASCADE
15 ON UPDATE CASCADE,
16 "state" INTEGER NOT NULL DEFAULT 1,
17 "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL,
18 "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL,
19 "lastSyncAt" TIMESTAMP WITH TIME ZONE,
20 PRIMARY KEY ("id")
21 );
22 `
23 await utils.sequelize.query(query, { transaction: utils.transaction })
24}
25
26async function down (utils: {
27 queryInterface: Sequelize.QueryInterface
28 transaction: Sequelize.Transaction
29}) {
30 await utils.queryInterface.dropTable('videoChannelSync', { transaction: utils.transaction })
31}
32
33export {
34 up,
35 down
36}