UNPKG

@grouparoo/core

Version:
21 lines (20 loc) 946 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { up: async (queryInterface, DataTypes) => { await queryInterface.addColumn("profilePropertyRules", "identifying", { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: false, }); // we need to pick one of the existing rules to be identifying - prefer the oldest unique rule. const [results] = await queryInterface.sequelize.query('select * from "profilePropertyRules" order by "unique" desc, "createdAt" desc limit 1'); if (results.length === 1) { const rule = results[0]; await queryInterface.sequelize.query(`update "profilePropertyRules" set identifying=true where guid='${rule["guid"]}'`); } }, down: async (queryInterface) => { await queryInterface.removeColumn("profilePropertyRules", "identifying"); }, };