From 6321cbc3e7a43257b03b3285ab69b7977fd7f616 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 8 Oct 2018 11:58:18 +0200 Subject: Avoid old issue regarding duplicated hosts in db --- server/initializers/migrations/0275-video-file-unique.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0275-video-file-unique.ts b/server/initializers/migrations/0275-video-file-unique.ts index fd89188c0..e321ecb04 100644 --- a/server/initializers/migrations/0275-video-file-unique.ts +++ b/server/initializers/migrations/0275-video-file-unique.ts @@ -5,6 +5,12 @@ async function up (utils: { queryInterface: Sequelize.QueryInterface sequelize: Sequelize.Sequelize }): Promise { + // Delete duplicated keys + { + const query = 'DELETE FROM "server" s1 USING "server" s2 WHERE s1.id < s2.id AND s1."host" = s2."host"' + await utils.sequelize.query(query) + } + { const query = 'DELETE FROM "videoFile" vf1 USING "videoFile" vf2 WHERE vf1.id < vf2.id ' + 'AND vf1."videoId" = vf2."videoId" AND vf1.resolution = vf2.resolution AND vf1.fps IS NULL' -- cgit v1.2.3 From 64cc5e8575fda47b281ae20abf0020e27fc8ce7c Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 5 Oct 2018 15:17:34 +0200 Subject: add webtorrent opt-out settings - add a key in localstorage to remember the opt-out - add a user setting --- .../migrations/0280-webtorrent-policy-user.ts | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 server/initializers/migrations/0280-webtorrent-policy-user.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0280-webtorrent-policy-user.ts b/server/initializers/migrations/0280-webtorrent-policy-user.ts new file mode 100644 index 000000000..d24f6709e --- /dev/null +++ b/server/initializers/migrations/0280-webtorrent-policy-user.ts @@ -0,0 +1,26 @@ +import * as Sequelize from 'sequelize' +import { values } from 'lodash' +import { WEBTORRENT_POLICY_TYPES } from '../constants' + +async function up (utils: { + transaction: Sequelize.Transaction + queryInterface: Sequelize.QueryInterface + sequelize: Sequelize.Sequelize +}): Promise { + { + const data = { + type: Sequelize.ENUM(values(WEBTORRENT_POLICY_TYPES)), + allowNull: false, + defaultValue: 'enable' + } + + await utils.queryInterface.addColumn('user', 'webTorrentPolicy', data) + } + +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { up, down } -- cgit v1.2.3 From ed638e5325096ef580da20f370ac61c59cd48cf7 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Fri, 12 Oct 2018 18:12:39 +0200 Subject: move to boolean switch --- .../migrations/0280-webtorrent-policy-user.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0280-webtorrent-policy-user.ts b/server/initializers/migrations/0280-webtorrent-policy-user.ts index d24f6709e..e6488356a 100644 --- a/server/initializers/migrations/0280-webtorrent-policy-user.ts +++ b/server/initializers/migrations/0280-webtorrent-policy-user.ts @@ -1,6 +1,4 @@ import * as Sequelize from 'sequelize' -import { values } from 'lodash' -import { WEBTORRENT_POLICY_TYPES } from '../constants' async function up (utils: { transaction: Sequelize.Transaction @@ -9,18 +7,22 @@ async function up (utils: { }): Promise { { const data = { - type: Sequelize.ENUM(values(WEBTORRENT_POLICY_TYPES)), + type: Sequelize.BOOLEAN, allowNull: false, - defaultValue: 'enable' + defaultValue: true } - await utils.queryInterface.addColumn('user', 'webTorrentPolicy', data) + await utils.queryInterface.addColumn('user', 'webTorrentEnabled', data) } } -function down (options) { - throw new Error('Not implemented.') +async function down (utils: { + transaction: Sequelize.Transaction + queryInterface: Sequelize.QueryInterface + sequelize: Sequelize.Sequelize +}): Promise { + await utils.queryInterface.removeColumn('user', 'webTorrentEnabled') } export { up, down } -- cgit v1.2.3 From d23e6a1c97a6ae3ca8d340a8c9adad268a5be57e Mon Sep 17 00:00:00 2001 From: BRAINS YUM <43896676+McFlat@users.noreply.github.com> Date: Fri, 19 Oct 2018 01:54:01 -0500 Subject: Feature/description support fields length 1000 (#1267) * fix migrations to not use config constant values as it can introduce bugs later when they change; (fixes #1259) remove constant fields imports from migrations * add migrations to update description and support fields to 1000 (fixes #1258) * fix client/server account and video_channel description/support fields to be max len 1000 (fixes #1258); fix test Should fail with a too long description; fix test Should fail with a long description; fix test Should fail with a long description; Remove USER.SUPPORT from constants since that field no longer exists; null not false, in migrations/0280-description-support.ts; video support field 1000, oops; * rename migration 0280-description-support.ts -> 0285-description-support.ts; update video support maxlength text --- server/initializers/migrations/0120-video-null.ts | 3 +- server/initializers/migrations/0195-support.ts | 9 ++-- .../initializers/migrations/0245-user-blocked.ts | 3 +- .../migrations/0250-video-abuse-state.ts | 3 +- .../migrations/0255-video-blacklist-reason.ts | 3 +- .../migrations/0260-upload-quota-daily.ts | 1 - .../migrations/0285-description-support.ts | 53 ++++++++++++++++++++++ 7 files changed, 61 insertions(+), 14 deletions(-) create mode 100644 server/initializers/migrations/0285-description-support.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0120-video-null.ts b/server/initializers/migrations/0120-video-null.ts index 63f3984dd..6d253f04f 100644 --- a/server/initializers/migrations/0120-video-null.ts +++ b/server/initializers/migrations/0120-video-null.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../constants' async function up (utils: { transaction: Sequelize.Transaction, @@ -28,7 +27,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max), + type: Sequelize.STRING(10000), allowNull: true, defaultValue: null } diff --git a/server/initializers/migrations/0195-support.ts b/server/initializers/migrations/0195-support.ts index 8722a5f22..3b9eabe79 100644 --- a/server/initializers/migrations/0195-support.ts +++ b/server/initializers/migrations/0195-support.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../index' async function up (utils: { transaction: Sequelize.Transaction, @@ -8,7 +7,7 @@ async function up (utils: { }): Promise { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.SUPPORT.max), + type: Sequelize.STRING(500), allowNull: true, defaultValue: null } @@ -17,7 +16,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_CHANNELS.SUPPORT.max), + type: Sequelize.STRING(500), allowNull: true, defaultValue: null } @@ -26,7 +25,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.DESCRIPTION.max), + type: Sequelize.STRING(250), allowNull: true, defaultValue: null } @@ -35,7 +34,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEOS.DESCRIPTION.max), + type: Sequelize.STRING(10000), allowNull: true, defaultValue: null } diff --git a/server/initializers/migrations/0245-user-blocked.ts b/server/initializers/migrations/0245-user-blocked.ts index 5a04ecd2b..19c7d5b9c 100644 --- a/server/initializers/migrations/0245-user-blocked.ts +++ b/server/initializers/migrations/0245-user-blocked.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../constants' async function up (utils: { transaction: Sequelize.Transaction @@ -31,7 +30,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.USERS.BLOCKED_REASON.max), + type: Sequelize.STRING(250), allowNull: true, defaultValue: null } diff --git a/server/initializers/migrations/0250-video-abuse-state.ts b/server/initializers/migrations/0250-video-abuse-state.ts index acb668ae1..50de25182 100644 --- a/server/initializers/migrations/0250-video-abuse-state.ts +++ b/server/initializers/migrations/0250-video-abuse-state.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../constants' import { VideoAbuseState } from '../../../shared/models/videos' async function up (utils: { @@ -32,7 +31,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_ABUSES.MODERATION_COMMENT.max), + type: Sequelize.STRING(300), allowNull: true, defaultValue: null } diff --git a/server/initializers/migrations/0255-video-blacklist-reason.ts b/server/initializers/migrations/0255-video-blacklist-reason.ts index a380e620e..69d6efb9e 100644 --- a/server/initializers/migrations/0255-video-blacklist-reason.ts +++ b/server/initializers/migrations/0255-video-blacklist-reason.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../constants' import { VideoAbuseState } from '../../../shared/models/videos' async function up (utils: { @@ -10,7 +9,7 @@ async function up (utils: { { const data = { - type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max), + type: Sequelize.STRING(300), allowNull: true, defaultValue: null } diff --git a/server/initializers/migrations/0260-upload-quota-daily.ts b/server/initializers/migrations/0260-upload-quota-daily.ts index d25154ba6..cbbe391ef 100644 --- a/server/initializers/migrations/0260-upload-quota-daily.ts +++ b/server/initializers/migrations/0260-upload-quota-daily.ts @@ -1,5 +1,4 @@ import * as Sequelize from 'sequelize' -import { CONSTRAINTS_FIELDS } from '../constants' async function up (utils: { transaction: Sequelize.Transaction diff --git a/server/initializers/migrations/0285-description-support.ts b/server/initializers/migrations/0285-description-support.ts new file mode 100644 index 000000000..85ef4ef39 --- /dev/null +++ b/server/initializers/migrations/0285-description-support.ts @@ -0,0 +1,53 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + const data = { + type: Sequelize.STRING(1000), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('video', 'support', data) + } + + { + const data = { + type: Sequelize.STRING(1000), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('videoChannel', 'support', data) + } + + { + const data = { + type: Sequelize.STRING(1000), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('videoChannel', 'description', data) + } + + { + const data = { + type: Sequelize.STRING(1000), + allowNull: true, + defaultValue: null + } + await utils.queryInterface.changeColumn('account', 'description', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 5c6d985faeef1d6793d3f44ca6374f1a9b722806 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 14 Nov 2018 15:01:28 +0100 Subject: Check activities host --- .../migrations/0290-account-video-rate-url.ts | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 server/initializers/migrations/0290-account-video-rate-url.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0290-account-video-rate-url.ts b/server/initializers/migrations/0290-account-video-rate-url.ts new file mode 100644 index 000000000..bdabf2929 --- /dev/null +++ b/server/initializers/migrations/0290-account-video-rate-url.ts @@ -0,0 +1,46 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + const data = { + type: Sequelize.STRING(2000), + allowNull: true + } + + await utils.queryInterface.addColumn('accountVideoRate', 'url', data) + } + + { + const builtUrlQuery = `SELECT "actor"."url" || '/' || "accountVideoRate"."type" || 's/' || "videoId" ` + + 'FROM "accountVideoRate" ' + + 'INNER JOIN account ON account.id = "accountVideoRate"."accountId" ' + + 'INNER JOIN actor ON actor.id = account."actorId" ' + + 'WHERE "base".id = "accountVideoRate".id' + + const query = 'UPDATE "accountVideoRate" base SET "url" = (' + builtUrlQuery + ') WHERE "url" IS NULL' + await utils.sequelize.query(query) + } + + { + const data = { + type: Sequelize.STRING(2000), + allowNull: false, + defaultValue: null + } + await utils.queryInterface.changeColumn('accountVideoRate', 'url', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 14e2014acc1362cfbb770c051a7254b156cd8efb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 Dec 2018 14:52:50 +0100 Subject: Support additional video extensions --- .../migrations/0295-video-file-extname.ts | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 server/initializers/migrations/0295-video-file-extname.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0295-video-file-extname.ts b/server/initializers/migrations/0295-video-file-extname.ts new file mode 100644 index 000000000..dbf249f66 --- /dev/null +++ b/server/initializers/migrations/0295-video-file-extname.ts @@ -0,0 +1,49 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + await utils.queryInterface.renameColumn('videoFile', 'extname', 'extname_old') + } + + { + const data = { + type: Sequelize.STRING, + defaultValue: null, + allowNull: true + } + + await utils.queryInterface.addColumn('videoFile', 'extname', data) + } + + { + const query = 'UPDATE "videoFile" SET "extname" = "extname_old"::text' + await utils.sequelize.query(query) + } + + { + const data = { + type: Sequelize.STRING, + defaultValue: null, + allowNull: false + } + await utils.queryInterface.changeColumn('videoFile', 'extname', data) + } + + { + await utils.queryInterface.removeColumn('videoFile', 'extname_old') + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 8b9a525a180cc9f3a98c334cc052dcfc8f36dcd4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 17 Dec 2018 15:52:38 +0100 Subject: Add history on server side Add ability to disable, clear and list user videos history --- .../migrations/0300-user-videos-history-enabled.ts | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 server/initializers/migrations/0300-user-videos-history-enabled.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0300-user-videos-history-enabled.ts b/server/initializers/migrations/0300-user-videos-history-enabled.ts new file mode 100644 index 000000000..aa5fc21fb --- /dev/null +++ b/server/initializers/migrations/0300-user-videos-history-enabled.ts @@ -0,0 +1,27 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + const data = { + type: Sequelize.BOOLEAN, + allowNull: false, + defaultValue: true + } + + await utils.queryInterface.addColumn('user', 'videosHistoryEnabled', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 56b13bd193b076d32925f0ad14b755b250b803a8 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Dec 2018 11:24:34 +0100 Subject: Fix federation of some videos If we don't transcode additional resolutions, and user decided to wait transcoding before publishing the video --- .../migrations/0305-fix-unfederated-videos.ts | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 server/initializers/migrations/0305-fix-unfederated-videos.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0305-fix-unfederated-videos.ts b/server/initializers/migrations/0305-fix-unfederated-videos.ts new file mode 100644 index 000000000..be206601f --- /dev/null +++ b/server/initializers/migrations/0305-fix-unfederated-videos.ts @@ -0,0 +1,52 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + { + const query = `INSERT INTO "videoShare" (url, "actorId", "videoId", "createdAt", "updatedAt") ` + + `(` + + `SELECT ` + + `video.url || '/announces/' || "videoChannel"."actorId" as url, ` + + `"videoChannel"."actorId" AS "actorId", ` + + `"video"."id" AS "videoId", ` + + `NOW() AS "createdAt", ` + + `NOW() AS "updatedAt" ` + + `FROM video ` + + `INNER JOIN "videoChannel" ON "video"."channelId" = "videoChannel"."id" ` + + `WHERE "video"."remote" = false AND "video"."privacy" != 3 AND "video"."state" = 1` + + `) ` + + `ON CONFLICT DO NOTHING` + + await utils.sequelize.query(query) + } + + { + const query = `INSERT INTO "videoShare" (url, "actorId", "videoId", "createdAt", "updatedAt") ` + + `(` + + `SELECT ` + + `video.url || '/announces/' || (SELECT id FROM actor WHERE "preferredUsername" = 'peertube' ORDER BY id ASC LIMIT 1) as url, ` + + `(SELECT id FROM actor WHERE "preferredUsername" = 'peertube' ORDER BY id ASC LIMIT 1) AS "actorId", ` + + `"video"."id" AS "videoId", ` + + `NOW() AS "createdAt", ` + + `NOW() AS "updatedAt" ` + + `FROM video ` + + `WHERE "video"."remote" = false AND "video"."privacy" != 3 AND "video"."state" = 1` + + `) ` + + `ON CONFLICT DO NOTHING` + + await utils.sequelize.query(query) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 439b1744f5f50b8530cded9398d51aa4bb5ed4ff Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Dec 2018 15:25:24 +0100 Subject: Optimize index sizes --- .../migrations/0310-drop-unused-video-indexes.ts | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 server/initializers/migrations/0310-drop-unused-video-indexes.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0310-drop-unused-video-indexes.ts b/server/initializers/migrations/0310-drop-unused-video-indexes.ts new file mode 100644 index 000000000..d51f430c0 --- /dev/null +++ b/server/initializers/migrations/0310-drop-unused-video-indexes.ts @@ -0,0 +1,32 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize, + db: any +}): Promise { + const indexNames = [ + 'video_category', + 'video_licence', + 'video_nsfw', + 'video_language', + 'video_wait_transcoding', + 'video_state', + 'video_remote', + 'video_likes' + ] + + for (const indexName of indexNames) { + await utils.sequelize.query('DROP INDEX IF EXISTS "' + indexName + '";') + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 Dec 2018 13:47:17 +0100 Subject: Add notification settings migration --- .../migrations/0315-user-notifications.ts | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 server/initializers/migrations/0315-user-notifications.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.ts new file mode 100644 index 000000000..2bd9c657d --- /dev/null +++ b/server/initializers/migrations/0315-user-notifications.ts @@ -0,0 +1,41 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + + { + const query = ` +CREATE TABLE IF NOT EXISTS "userNotificationSetting" ("id" SERIAL, +"newVideoFromSubscription" INTEGER NOT NULL DEFAULT NULL, +"newCommentOnMyVideo" INTEGER NOT NULL DEFAULT NULL, +"videoAbuseAsModerator" INTEGER NOT NULL DEFAULT NULL, +"blacklistOnMyVideo" INTEGER NOT NULL DEFAULT NULL, +"userId" INTEGER REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE, +"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, +"updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, +PRIMARY KEY ("id")) +` + await utils.sequelize.query(query) + } + + { + const query = 'INSERT INTO "userNotificationSetting" ' + + '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + + '"userId", "createdAt", "updatedAt") ' + + '(SELECT 2, 2, 4, 4, id, NOW(), NOW() FROM "user")' + + await utils.sequelize.query(query) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From dc13348070d808d0ba3feb56a435b835c2e7e791 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 2 Jan 2019 16:37:43 +0100 Subject: Add import finished and video published notifs --- server/initializers/migrations/0315-user-notifications.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.ts index 2bd9c657d..8c54c5d6c 100644 --- a/server/initializers/migrations/0315-user-notifications.ts +++ b/server/initializers/migrations/0315-user-notifications.ts @@ -13,6 +13,8 @@ CREATE TABLE IF NOT EXISTS "userNotificationSetting" ("id" SERIAL, "newCommentOnMyVideo" INTEGER NOT NULL DEFAULT NULL, "videoAbuseAsModerator" INTEGER NOT NULL DEFAULT NULL, "blacklistOnMyVideo" INTEGER NOT NULL DEFAULT NULL, +"myVideoPublished" INTEGER NOT NULL DEFAULT NULL, +"myVideoImportFinished" INTEGER NOT NULL DEFAULT NULL, "userId" INTEGER REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, @@ -24,8 +26,8 @@ PRIMARY KEY ("id")) { const query = 'INSERT INTO "userNotificationSetting" ' + '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + - '"userId", "createdAt", "updatedAt") ' + - '(SELECT 2, 2, 4, 4, id, NOW(), NOW() FROM "user")' + '"myVideoPublished", "myVideoImportFinished", "userId", "createdAt", "updatedAt") ' + + '(SELECT 2, 2, 4, 4, 2, 2, id, NOW(), NOW() FROM "user")' await utils.sequelize.query(query) } -- cgit v1.2.3 From f7cc67b455a12ccae9b0ea16876d166720364357 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 4 Jan 2019 08:56:20 +0100 Subject: Add new follow, mention and user registered notifs --- server/initializers/migrations/0315-user-notifications.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.ts index 8c54c5d6c..34f9fd193 100644 --- a/server/initializers/migrations/0315-user-notifications.ts +++ b/server/initializers/migrations/0315-user-notifications.ts @@ -15,6 +15,9 @@ CREATE TABLE IF NOT EXISTS "userNotificationSetting" ("id" SERIAL, "blacklistOnMyVideo" INTEGER NOT NULL DEFAULT NULL, "myVideoPublished" INTEGER NOT NULL DEFAULT NULL, "myVideoImportFinished" INTEGER NOT NULL DEFAULT NULL, +"newUserRegistration" INTEGER NOT NULL DEFAULT NULL, +"newFollow" INTEGER NOT NULL DEFAULT NULL, +"commentMention" INTEGER NOT NULL DEFAULT NULL, "userId" INTEGER REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE, "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, @@ -26,8 +29,9 @@ PRIMARY KEY ("id")) { const query = 'INSERT INTO "userNotificationSetting" ' + '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + - '"myVideoPublished", "myVideoImportFinished", "userId", "createdAt", "updatedAt") ' + - '(SELECT 2, 2, 4, 4, 2, 2, id, NOW(), NOW() FROM "user")' + '"myVideoPublished", "myVideoImportFinished", "newUserRegistration", "newFollow", "commentMention", ' + + '"userId", "createdAt", "updatedAt") ' + + '(SELECT 2, 2, 4, 4, 2, 2, 2, 2, 2, id, NOW(), NOW() FROM "user")' await utils.sequelize.query(query) } -- cgit v1.2.3 From 2f1548fda32c3ba9e53913270394eedfacd55986 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 8 Jan 2019 11:26:41 +0100 Subject: Add notifications in the client --- server/initializers/migrations/0315-user-notifications.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0315-user-notifications.ts b/server/initializers/migrations/0315-user-notifications.ts index 34f9fd193..8284c58a0 100644 --- a/server/initializers/migrations/0315-user-notifications.ts +++ b/server/initializers/migrations/0315-user-notifications.ts @@ -31,7 +31,7 @@ PRIMARY KEY ("id")) '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + '"myVideoPublished", "myVideoImportFinished", "newUserRegistration", "newFollow", "commentMention", ' + '"userId", "createdAt", "updatedAt") ' + - '(SELECT 2, 2, 4, 4, 2, 2, 2, 2, 2, id, NOW(), NOW() FROM "user")' + '(SELECT 1, 1, 3, 3, 1, 1, 1, 1, 1, id, NOW(), NOW() FROM "user")' await utils.sequelize.query(query) } -- cgit v1.2.3 From 5abb9fbbd12e7097e348d6a38622d364b1fa47ed Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 10 Jan 2019 15:39:51 +0100 Subject: Add ability to unfederate a local video (on blacklist) --- .../migrations/0320-blacklist-unfederate.ts | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 server/initializers/migrations/0320-blacklist-unfederate.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0320-blacklist-unfederate.ts b/server/initializers/migrations/0320-blacklist-unfederate.ts new file mode 100644 index 000000000..6fb7bbb90 --- /dev/null +++ b/server/initializers/migrations/0320-blacklist-unfederate.ts @@ -0,0 +1,27 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + + { + const data = { + type: Sequelize.BOOLEAN, + allowNull: false, + defaultValue: false + } + + await utils.queryInterface.addColumn('videoBlacklist', 'unfederated', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 1506307f2f903ce0f80155072a33345c702b7c76 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 14 Jan 2019 16:48:38 +0100 Subject: Increase abuse length to 3000 And correctly handle new lines --- .../migrations/0325-video-abuse-fields.ts | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 server/initializers/migrations/0325-video-abuse-fields.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0325-video-abuse-fields.ts b/server/initializers/migrations/0325-video-abuse-fields.ts new file mode 100644 index 000000000..fca6d666f --- /dev/null +++ b/server/initializers/migrations/0325-video-abuse-fields.ts @@ -0,0 +1,37 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + + { + const data = { + type: Sequelize.STRING(3000), + allowNull: false, + defaultValue: null + } + + await utils.queryInterface.changeColumn('videoAbuse', 'reason', data) + } + + { + const data = { + type: Sequelize.STRING(3000), + allowNull: true, + defaultValue: null + } + + await utils.queryInterface.changeColumn('videoAbuse', 'moderationComment', data) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3 From 092092969633bbcf6d4891a083ea497a7d5c3154 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 29 Jan 2019 08:37:25 +0100 Subject: Add hls support on server --- .../migrations/0330-video-streaming-playlist.ts | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 server/initializers/migrations/0330-video-streaming-playlist.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0330-video-streaming-playlist.ts b/server/initializers/migrations/0330-video-streaming-playlist.ts new file mode 100644 index 000000000..c85a762ab --- /dev/null +++ b/server/initializers/migrations/0330-video-streaming-playlist.ts @@ -0,0 +1,51 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction, + queryInterface: Sequelize.QueryInterface, + sequelize: Sequelize.Sequelize +}): Promise { + + { + const query = ` + CREATE TABLE IF NOT EXISTS "videoStreamingPlaylist" +( + "id" SERIAL, + "type" INTEGER NOT NULL, + "playlistUrl" VARCHAR(2000) NOT NULL, + "p2pMediaLoaderInfohashes" VARCHAR(255)[] NOT NULL, + "segmentsSha256Url" VARCHAR(255) NOT NULL, + "videoId" INTEGER NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE, + "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, + "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, + PRIMARY KEY ("id") +);` + await utils.sequelize.query(query) + } + + { + const data = { + type: Sequelize.INTEGER, + allowNull: true, + defaultValue: null + } + + await utils.queryInterface.changeColumn('videoRedundancy', 'videoFileId', data) + } + + { + const query = 'ALTER TABLE "videoRedundancy" ADD COLUMN "videoStreamingPlaylistId" INTEGER NULL ' + + 'REFERENCES "videoStreamingPlaylist" ("id") ON DELETE CASCADE ON UPDATE CASCADE' + + await utils.sequelize.query(query) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3