Verified Commit d2a5c4e1 authored by Chocobozzz's avatar Chocobozzz
Browse files

Fix broken migration introduced in 2.2.0-rc.1

parent c123027f
......@@ -14,7 +14,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
// ---------------------------------------------------------------------------
const LAST_MIGRATION_VERSION = 505
const LAST_MIGRATION_VERSION = 510
// ---------------------------------------------------------------------------
......
......@@ -6,18 +6,26 @@ async function up (utils: {
sequelize: Sequelize.Sequelize
}): Promise<void> {
const metadata = {
type: Sequelize.JSONB,
allowNull: true
}
await utils.queryInterface.addColumn('videoFile', 'metadata', metadata)
// We made a mistake with the migration in 2.2.0-rc.1
// Docker containers did not include this migration file
// So we check the table definition and add the column if it does not exist
const tableDefinition = await utils.queryInterface.describeTable('videoFile')
const metadataUrl = {
type: Sequelize.STRING,
allowNull: true
if (!tableDefinition['metadata']) {
const metadata = {
type: Sequelize.JSONB,
allowNull: true
}
await utils.queryInterface.addColumn('videoFile', 'metadata', metadata)
}
await utils.queryInterface.addColumn('videoFile', 'metadataUrl', metadataUrl)
if (!tableDefinition['metadataUrl']) {
const metadataUrl = {
type: Sequelize.STRING,
allowNull: true
}
await utils.queryInterface.addColumn('videoFile', 'metadataUrl', metadataUrl)
}
}
function down (options) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment