From 7a303497489950328667332ce0ed8841d6dfa19e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 19 Jun 2023 11:33:13 +0200 Subject: Fix migration conflict --- .../initializers/migrations/0780-thumbnail-disk.ts | 47 ---------------------- .../initializers/migrations/0785-thumbnail-disk.ts | 47 ++++++++++++++++++++++ 2 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 server/initializers/migrations/0780-thumbnail-disk.ts create mode 100644 server/initializers/migrations/0785-thumbnail-disk.ts (limited to 'server/initializers/migrations') diff --git a/server/initializers/migrations/0780-thumbnail-disk.ts b/server/initializers/migrations/0780-thumbnail-disk.ts deleted file mode 100644 index 0824c042e..000000000 --- a/server/initializers/migrations/0780-thumbnail-disk.ts +++ /dev/null @@ -1,47 +0,0 @@ -import * as Sequelize from 'sequelize' - -async function up (utils: { - transaction: Sequelize.Transaction - queryInterface: Sequelize.QueryInterface - sequelize: Sequelize.Sequelize -}): Promise { - const { transaction } = utils - - { - const data = { - type: Sequelize.BOOLEAN, - allowNull: true, - defaultValue: true - } - - await utils.queryInterface.addColumn('thumbnail', 'onDisk', data, { transaction }) - } - - { - // Remote previews are not on the disk - await utils.sequelize.query( - 'UPDATE "thumbnail" SET "onDisk" = FALSE ' + - 'WHERE "type" = 2 AND "videoId" NOT IN (SELECT "id" FROM "video" WHERE "remote" IS FALSE)', - { transaction } - ) - } - - { - const data = { - type: Sequelize.BOOLEAN, - allowNull: false, - defaultValue: null - } - - await utils.queryInterface.changeColumn('thumbnail', 'onDisk', data, { transaction }) - } -} - -function down (options) { - throw new Error('Not implemented.') -} - -export { - up, - down -} diff --git a/server/initializers/migrations/0785-thumbnail-disk.ts b/server/initializers/migrations/0785-thumbnail-disk.ts new file mode 100644 index 000000000..0824c042e --- /dev/null +++ b/server/initializers/migrations/0785-thumbnail-disk.ts @@ -0,0 +1,47 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction + queryInterface: Sequelize.QueryInterface + sequelize: Sequelize.Sequelize +}): Promise { + const { transaction } = utils + + { + const data = { + type: Sequelize.BOOLEAN, + allowNull: true, + defaultValue: true + } + + await utils.queryInterface.addColumn('thumbnail', 'onDisk', data, { transaction }) + } + + { + // Remote previews are not on the disk + await utils.sequelize.query( + 'UPDATE "thumbnail" SET "onDisk" = FALSE ' + + 'WHERE "type" = 2 AND "videoId" NOT IN (SELECT "id" FROM "video" WHERE "remote" IS FALSE)', + { transaction } + ) + } + + { + const data = { + type: Sequelize.BOOLEAN, + allowNull: false, + defaultValue: null + } + + await utils.queryInterface.changeColumn('thumbnail', 'onDisk', data, { transaction }) + } +} + +function down (options) { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3