"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: Object.getOwnPropertyDescriptor(all, name).get
    });
}
_export(exports, {
    get down () {
        return down;
    },
    get up () {
        return up;
    }
});
const OLD_TABLE = 'signers';
const NEW_TABLE = 'signers_historical';
async function up(query) {
    await query.sequelize.query(`UPDATE ${OLD_TABLE} SET private_key = NULL`);
    await query.renameTable(OLD_TABLE, NEW_TABLE);
    const [[{ delete_after }]] = await query.sequelize.query(`SELECT COALESCE(
      to_char(MAX(validity_period_end) + INTERVAL '7 years', 'YYYY-MM-DD'),
      to_char(NOW() + INTERVAL '7 years', 'YYYY-MM-DD')
    ) AS delete_after FROM ${NEW_TABLE}`);
    await query.sequelize.query(`COMMENT ON TABLE ${NEW_TABLE} IS $comment$Historical VDS-NC signer records retained for compliance. Private keys cleared. Safe to DROP after ${delete_after}.$comment$`);
}
async function down(query) {
    await query.sequelize.query(`COMMENT ON TABLE ${NEW_TABLE} IS NULL`);
    await query.renameTable(NEW_TABLE, OLD_TABLE);
}

//# sourceMappingURL=1771287573000-dropSignersTable.js.map