aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0005-email-pod.ts3
-rw-r--r--server/initializers/migrations/0010-email-user.ts3
-rw-r--r--server/initializers/migrations/0030-video-category.ts3
-rw-r--r--server/initializers/migrations/0035-video-licence.ts3
-rw-r--r--server/initializers/migrations/0040-video-nsfw.ts3
-rw-r--r--server/initializers/migrations/0055-video-uuid.ts2
-rw-r--r--server/initializers/migrations/0070-user-video-quota.ts3
-rw-r--r--server/initializers/migrations/0155-video-comments-enabled.ts3
-rw-r--r--server/initializers/migrations/0230-kue-to-bull.ts9
9 files changed, 18 insertions, 14 deletions
diff --git a/server/initializers/migrations/0005-email-pod.ts b/server/initializers/migrations/0005-email-pod.ts
index ab60f3adb..c34a12255 100644
--- a/server/initializers/migrations/0005-email-pod.ts
+++ b/server/initializers/migrations/0005-email-pod.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.STRING(400), 13 type: Sequelize.STRING(400),
13 allowNull: false, 14 allowNull: false,
14 defaultValue: '' 15 defaultValue: ''
15 } 16 } as Migration.String
16 17
17 return q.addColumn('Pods', 'email', data) 18 return q.addColumn('Pods', 'email', data)
18 .then(() => { 19 .then(() => {
diff --git a/server/initializers/migrations/0010-email-user.ts b/server/initializers/migrations/0010-email-user.ts
index 33d13ce55..37a7b0bb3 100644
--- a/server/initializers/migrations/0010-email-user.ts
+++ b/server/initializers/migrations/0010-email-user.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.STRING(400), 13 type: Sequelize.STRING(400),
13 allowNull: false, 14 allowNull: false,
14 defaultValue: '' 15 defaultValue: ''
15 } 16 } as Migration.String
16 return q.addColumn('Users', 'email', data) 17 return q.addColumn('Users', 'email', data)
17 .then(() => { 18 .then(() => {
18 const query = 'UPDATE "Users" SET "email" = CONCAT("username", \'@example.com\')' 19 const query = 'UPDATE "Users" SET "email" = CONCAT("username", \'@example.com\')'
diff --git a/server/initializers/migrations/0030-video-category.ts b/server/initializers/migrations/0030-video-category.ts
index 41bc1aa98..f784f820d 100644
--- a/server/initializers/migrations/0030-video-category.ts
+++ b/server/initializers/migrations/0030-video-category.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.INTEGER, 13 type: Sequelize.INTEGER,
13 allowNull: false, 14 allowNull: false,
14 defaultValue: 0 15 defaultValue: 0
15 } 16 } as Migration.Integer
16 17
17 return q.addColumn('Videos', 'category', data) 18 return q.addColumn('Videos', 'category', data)
18 .then(() => { 19 .then(() => {
diff --git a/server/initializers/migrations/0035-video-licence.ts b/server/initializers/migrations/0035-video-licence.ts
index 7ab49e147..3d0b0bac9 100644
--- a/server/initializers/migrations/0035-video-licence.ts
+++ b/server/initializers/migrations/0035-video-licence.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.INTEGER, 13 type: Sequelize.INTEGER,
13 allowNull: false, 14 allowNull: false,
14 defaultValue: 0 15 defaultValue: 0
15 } 16 } as Migration.Integer
16 17
17 return q.addColumn('Videos', 'licence', data) 18 return q.addColumn('Videos', 'licence', data)
18 .then(() => { 19 .then(() => {
diff --git a/server/initializers/migrations/0040-video-nsfw.ts b/server/initializers/migrations/0040-video-nsfw.ts
index 0460e661d..f7f70d3c4 100644
--- a/server/initializers/migrations/0040-video-nsfw.ts
+++ b/server/initializers/migrations/0040-video-nsfw.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -12,7 +13,7 @@ function up (utils: {
12 type: Sequelize.BOOLEAN, 13 type: Sequelize.BOOLEAN,
13 allowNull: false, 14 allowNull: false,
14 defaultValue: false 15 defaultValue: false
15 } 16 } as Migration.Boolean
16 17
17 return q.addColumn('Videos', 'nsfw', data) 18 return q.addColumn('Videos', 'nsfw', data)
18 .then(() => { 19 .then(() => {
diff --git a/server/initializers/migrations/0055-video-uuid.ts b/server/initializers/migrations/0055-video-uuid.ts
index 9bc65917c..6db25f193 100644
--- a/server/initializers/migrations/0055-video-uuid.ts
+++ b/server/initializers/migrations/0055-video-uuid.ts
@@ -24,7 +24,7 @@ function up (utils: {
24 return utils.sequelize.query(query) 24 return utils.sequelize.query(query)
25 }) 25 })
26 .then(() => { 26 .then(() => {
27 dataUUID.defaultValue = null 27 dataUUID.defaultValue = null // FIXME:default value cannot be null if string
28 28
29 return q.changeColumn('Videos', 'uuid', dataUUID) 29 return q.changeColumn('Videos', 'uuid', dataUUID)
30 }) 30 })
diff --git a/server/initializers/migrations/0070-user-video-quota.ts b/server/initializers/migrations/0070-user-video-quota.ts
index dec4d46dd..37683432f 100644
--- a/server/initializers/migrations/0070-user-video-quota.ts
+++ b/server/initializers/migrations/0070-user-video-quota.ts
@@ -1,5 +1,6 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import * as Promise from 'bluebird' 2import * as Promise from 'bluebird'
3import { Migration } from '../../models/migrations'
3 4
4function up (utils: { 5function up (utils: {
5 transaction: Sequelize.Transaction, 6 transaction: Sequelize.Transaction,
@@ -13,7 +14,7 @@ function up (utils: {
13 type: Sequelize.BIGINT, 14 type: Sequelize.BIGINT,
14 allowNull: false, 15 allowNull: false,
15 defaultValue: -1 16 defaultValue: -1
16 } 17 } as Migration.BigInteger
17 18
18 return q.addColumn('Users', 'videoQuota', data) 19 return q.addColumn('Users', 'videoQuota', data)
19 .then(() => { 20 .then(() => {
diff --git a/server/initializers/migrations/0155-video-comments-enabled.ts b/server/initializers/migrations/0155-video-comments-enabled.ts
index 59f4110de..6949d3a0c 100644
--- a/server/initializers/migrations/0155-video-comments-enabled.ts
+++ b/server/initializers/migrations/0155-video-comments-enabled.ts
@@ -1,4 +1,5 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2import { Migration } from '../../models/migrations'
2 3
3async function up (utils: { 4async function up (utils: {
4 transaction: Sequelize.Transaction, 5 transaction: Sequelize.Transaction,
@@ -9,7 +10,7 @@ async function up (utils: {
9 type: Sequelize.BOOLEAN, 10 type: Sequelize.BOOLEAN,
10 allowNull: false, 11 allowNull: false,
11 defaultValue: true 12 defaultValue: true
12 } 13 } as Migration.Boolean
13 await utils.queryInterface.addColumn('video', 'commentsEnabled', data) 14 await utils.queryInterface.addColumn('video', 'commentsEnabled', data)
14 15
15 data.defaultValue = null 16 data.defaultValue = null
diff --git a/server/initializers/migrations/0230-kue-to-bull.ts b/server/initializers/migrations/0230-kue-to-bull.ts
index 5fad87a61..5f4d88bef 100644
--- a/server/initializers/migrations/0230-kue-to-bull.ts
+++ b/server/initializers/migrations/0230-kue-to-bull.ts
@@ -2,6 +2,7 @@ import * as Sequelize from 'sequelize'
2import { createClient } from 'redis' 2import { createClient } from 'redis'
3import { CONFIG } from '../constants' 3import { CONFIG } from '../constants'
4import { JobQueue } from '../../lib/job-queue' 4import { JobQueue } from '../../lib/job-queue'
5import { Redis } from '../../lib/redis'
5import { initDatabaseModels } from '../database' 6import { initDatabaseModels } from '../database'
6 7
7async function up (utils: { 8async function up (utils: {
@@ -12,11 +13,7 @@ async function up (utils: {
12 await initDatabaseModels(false) 13 await initDatabaseModels(false)
13 14
14 return new Promise((res, rej) => { 15 return new Promise((res, rej) => {
15 const client = createClient({ 16 const client = createClient(Redis.getRedisClient())
16 host: CONFIG.REDIS.HOSTNAME,
17 port: CONFIG.REDIS.PORT,
18 db: CONFIG.REDIS.DB
19 })
20 17
21 const jobsPrefix = 'q-' + CONFIG.WEBSERVER.HOST 18 const jobsPrefix = 'q-' + CONFIG.WEBSERVER.HOST
22 19
@@ -36,7 +33,7 @@ async function up (utils: {
36 return res({ type: job.type, payload: parsedData }) 33 return res({ type: job.type, payload: parsedData })
37 } catch (err) { 34 } catch (err) {
38 console.error('Cannot parse data %s.', job.data) 35 console.error('Cannot parse data %s.', job.data)
39 return res(null) 36 return res(undefined)
40 } 37 }
41 }) 38 })
42 }) 39 })