Skip to content

Commit 898d21d

Browse files
committed
Remove duplicated indices #21
1 parent d96a66c commit 898d21d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/db/00002_cleanup_indices.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
BEGIN;
2+
3+
-- Remove automatically created indices
4+
DROP INDEX IF EXISTS states_sort_key_index;
5+
6+
DROP INDEX IF EXISTS black_list_contract_tx_id_index;
7+
8+
DROP INDEX IF EXISTS errors_job_id_index;
9+
10+
COMMIT;
11+
12+
VACUUM;

src/db/nodeDb.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = {
2626
t.string('contract_tx_id').index();
2727
t.jsonb('evaluation_options');
2828
t.jsonb('sdk_config');
29-
t.string('job_id').index().unique();
29+
t.string('job_id').unique();
3030
t.string('failure').notNullable();
3131
t.timestamp('timestamp').defaultTo(knex.fn.now());
3232
});
@@ -35,7 +35,7 @@ module.exports = {
3535
const hasBlacklistTable = await knex.schema.hasTable('black_list');
3636
if (!hasBlacklistTable) {
3737
await knex.schema.createTable('black_list', function (t) {
38-
t.string('contract_tx_id').index().unique();
38+
t.string('contract_tx_id').unique();
3939
t.integer('failures');
4040
});
4141
}
@@ -46,7 +46,7 @@ module.exports = {
4646
t.string('contract_tx_id').unique();
4747
t.jsonb('manifest').notNullable();
4848
t.string('bundle_tx_id');
49-
t.string('sort_key').index();
49+
t.string('sort_key');
5050
t.string('signature').notNullable();
5151
t.string('state_hash').notNullable();
5252
t.timestamp('timestamp').defaultTo(knex.fn.now());

0 commit comments

Comments
 (0)