From e5d3e0c79d30f7b1a9d744dca027f325d29c4ae3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Aug 2021 09:27:14 +0200 Subject: Fix object storage migration It's too long on big instances --- .../initializers/migrations/0660-object-storage.ts | 34 ++++++++++------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'server/initializers') diff --git a/server/initializers/migrations/0660-object-storage.ts b/server/initializers/migrations/0660-object-storage.ts index c815c71c6..53cb89ce6 100644 --- a/server/initializers/migrations/0660-object-storage.ts +++ b/server/initializers/migrations/0660-object-storage.ts @@ -24,27 +24,25 @@ async function up (utils: { } { - await utils.queryInterface.addColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: true }) - } - { - await utils.sequelize.query( - `UPDATE "videoFile" SET "storage" = ${VideoStorage.FILE_SYSTEM}` - ) - } - { - await utils.queryInterface.changeColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: false }) + await utils.queryInterface.addColumn('videoFile', 'storage', { + type: Sequelize.INTEGER, + allowNull: true, + defaultValue: VideoStorage.FILE_SYSTEM + }) + await utils.queryInterface.changeColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: false, defaultValue: null }) } { - await utils.queryInterface.addColumn('videoStreamingPlaylist', 'storage', { type: Sequelize.INTEGER, allowNull: true }) - } - { - await utils.sequelize.query( - `UPDATE "videoStreamingPlaylist" SET "storage" = ${VideoStorage.FILE_SYSTEM}` - ) - } - { - await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'storage', { type: Sequelize.INTEGER, allowNull: false }) + await utils.queryInterface.addColumn('videoStreamingPlaylist', 'storage', { + type: Sequelize.INTEGER, + allowNull: true, + defaultValue: VideoStorage.FILE_SYSTEM + }) + await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'storage', { + type: Sequelize.INTEGER, + allowNull: false, + defaultValue: null + }) } } -- cgit v1.2.3