* Store import<->document relationship * Update 20221112152649-import-document-relationship.js * Store importId on collection, UI tweaks on import screen
49 lines
1.3 KiB
JavaScript
49 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
module.exports = {
|
|
async up(queryInterface, Sequelize) {
|
|
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.addColumn("documents", "importId", {
|
|
type: Sequelize.UUID,
|
|
allowNull: true,
|
|
references: {
|
|
model: "file_operations",
|
|
},
|
|
transaction,
|
|
});
|
|
await queryInterface.addColumn("collections", "importId", {
|
|
type: Sequelize.UUID,
|
|
allowNull: true,
|
|
references: {
|
|
model: "file_operations",
|
|
},
|
|
transaction,
|
|
});
|
|
await queryInterface.addIndex("documents", ["importId"], {
|
|
transaction
|
|
});
|
|
await queryInterface.addIndex("collections", ["importId"], {
|
|
transaction
|
|
});
|
|
});
|
|
|
|
},
|
|
|
|
async down(queryInterface) {
|
|
await queryInterface.sequelize.transaction(async (transaction) => {
|
|
await queryInterface.removeIndex("collections", ["importId"], {
|
|
transaction
|
|
});
|
|
await queryInterface.removeIndex("documents", ["importId"], {
|
|
transaction
|
|
});
|
|
await queryInterface.removeColumn("collections", "importId", {
|
|
transaction
|
|
});
|
|
await queryInterface.removeColumn("documents", "importId", {
|
|
transaction
|
|
});
|
|
});
|
|
}
|
|
};
|