Skip to content

Commit 00ebed2

Browse files
📝 Add docstrings to 5.21-changes
Docstrings generation was requested by @karthikps97. * #9293 (comment) The following files were modified: * `src/upgrade/upgrade_scripts/5.21.0/remove_datachunks_index.js`
1 parent 8ba55a8 commit 00ebed2

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright (C) 2025 NooBaa */
2+
"use strict";
3+
4+
/**
5+
* Drop the database index named "idx_btree_datachunks_dedup_key" if it exists.
6+
*
7+
* Executes the DROP INDEX operation against the connected database, logs success,
8+
* and rethrows any error after logging it.
9+
*
10+
* @param {{dbg: object, db_client: object}} args - Utilities required to perform the upgrade: a logger (`dbg`) and a database client (`db_client`).
11+
* @throws {Error} Re-throws any error encountered while executing the DROP INDEX statement.
12+
*/
13+
async function run({ dbg, db_client }) {
14+
const indexName = 'idx_btree_datachunks_dedup_key';
15+
16+
try {
17+
const pool = db_client.instance().get_pool();
18+
await pool.query(`DROP INDEX IF EXISTS ${indexName};`);
19+
20+
dbg.log2("Executed upgrade script for dropping index ", indexName);
21+
} catch (err) {
22+
dbg.error('An error ocurred in the upgrade process:', err);
23+
throw err;
24+
}
25+
}
26+
27+
module.exports = {
28+
run,
29+
description: 'Delete the "idx_btree_datachunks_dedup_key" index'
30+
};

0 commit comments

Comments
 (0)