diff --git a/package-lock.json b/package-lock.json index cd8f2d71d6..6d2bf449b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "origintrail_node", - "version": "6.2.0+hotfix1", + "version": "6.2.0+hotfix.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "origintrail_node", - "version": "6.2.0+hotfix1", + "version": "6.2.0+hotfix.2", "license": "ISC", "dependencies": { "@comunica/query-sparql": "^2.4.3", diff --git a/package.json b/package.json index 315419b4ca..f17413ff2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "origintrail_node", - "version": "6.2.0+hotfix1", + "version": "6.2.0+hotfix.2", "description": "OTNode V6", "main": "index.js", "type": "module", diff --git a/src/modules/repository/implementation/sequelize/migrations/20240126120000-shard-add-sha256blobl.js b/src/modules/repository/implementation/sequelize/migrations/20240126120000-shard-add-sha256blobl.js index 89059f3454..fa491e6bba 100644 --- a/src/modules/repository/implementation/sequelize/migrations/20240126120000-shard-add-sha256blobl.js +++ b/src/modules/repository/implementation/sequelize/migrations/20240126120000-shard-add-sha256blobl.js @@ -1,7 +1,11 @@ export async function up({ context: { queryInterface, Sequelize } }) { - await queryInterface.addColumn('shard', 'sha256_blob', { - type: Sequelize.BLOB, - }); + const tableInfo = await queryInterface.describeTable('shard'); + + if (!tableInfo.sha256_blob) { + await queryInterface.addColumn('shard', 'sha256_blob', { + type: Sequelize.BLOB, + }); + } const shards = await queryInterface.sequelize.query( 'SELECT peer_id, blockchain_id, sha256 FROM shard', diff --git a/src/modules/repository/implementation/sequelize/sequelize-repository.js b/src/modules/repository/implementation/sequelize/sequelize-repository.js index f232c34f8d..aae1f1c648 100644 --- a/src/modules/repository/implementation/sequelize/sequelize-repository.js +++ b/src/modules/repository/implementation/sequelize/sequelize-repository.js @@ -94,7 +94,13 @@ class SequelizeRepository { async runMigrations() { const migrator = createMigrator(this.models.sequelize, this.config, this.logger); - await migrator.up(); + try { + await migrator.up(); + } catch (error) { + this.logger.error(`Failed to execute ${migrator.name} migration: ${error.message}.`); + await migrator.down(); + throw error; + } } async loadModels() {