@grouparoo/core
Version:
The Grouparoo Core
25 lines (24 loc) • 995 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {
up: async (queryInterface, DataTypes) => {
await queryInterface.addColumn("schedules", "incremental", {
type: DataTypes.BOOLEAN,
allowNull: true,
defaultValue: false,
});
const [incrementalSources] = await queryInterface.sequelize.query(`SELECT * FROM "sources" WHERE type LIKE '%-import-table'`);
if (incrementalSources.length > 0) {
await queryInterface.sequelize.query(`UPDATE schedules SET incremental=true WHERE "sourceId" IN (${incrementalSources
.map((s) => `'${s.id}'`)
.join(", ")})`);
}
await queryInterface.changeColumn("schedules", "incremental", {
type: DataTypes.BOOLEAN,
allowNull: false,
});
},
down: async (queryInterface) => {
await queryInterface.removeColumn("schedules", "incremental");
},
};