@bsv/overlay
Version:
BSV Blockchain Overlay Services Engine
20 lines • 749 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.up = up;
exports.down = down;
/**
* Adds optimized index for findUTXOsForTopic queries.
* This query pattern is: WHERE topic = ? AND spent = false ORDER BY score
* The composite index (topic, spent, score) enables efficient range scans.
*/
async function up(knex) {
await knex.schema.table('outputs', function (table) {
table.index(['topic', 'spent', 'score'], 'idx_outputs_topic_spent_score');
});
}
async function down(knex) {
await knex.schema.table('outputs', function (table) {
table.dropIndex(['topic', 'spent', 'score'], 'idx_outputs_topic_spent_score');
});
}
//# sourceMappingURL=2025-11-11-001-utxo-lookup-index.js.map