exports.up = async function (knex) { const contactDetailObject = await knex('object_definitions') .where({ apiName: 'ContactDetail' }) .first(); if (!contactDetailObject) return; await knex('field_definitions') .where({ objectDefinitionId: contactDetailObject.id }) .whereIn('apiName', [ 'relatedObjectType', 'relatedObjectId', 'detailType', 'label', 'value', 'isPrimary', ]) .update({ isSystem: false, updated_at: knex.fn.now(), }); }; exports.down = async function (knex) { const contactDetailObject = await knex('object_definitions') .where({ apiName: 'ContactDetail' }) .first(); if (!contactDetailObject) return; await knex('field_definitions') .where({ objectDefinitionId: contactDetailObject.id }) .whereIn('apiName', [ 'relatedObjectType', 'relatedObjectId', 'detailType', 'label', 'value', 'isPrimary', ]) .update({ isSystem: true, updated_at: knex.fn.now(), }); };