Skip to content

Commit

Permalink
Remove duplicated indices #21
Browse files Browse the repository at this point in the history
  • Loading branch information
janekolszak committed Jan 30, 2023
1 parent d96a66c commit 898d21d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/db/00002_cleanup_indices.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
BEGIN;

-- Remove automatically created indices
DROP INDEX IF EXISTS states_sort_key_index;

DROP INDEX IF EXISTS black_list_contract_tx_id_index;

DROP INDEX IF EXISTS errors_job_id_index;

COMMIT;

VACUUM;
6 changes: 3 additions & 3 deletions src/db/nodeDb.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = {
t.string('contract_tx_id').index();
t.jsonb('evaluation_options');
t.jsonb('sdk_config');
t.string('job_id').index().unique();
t.string('job_id').unique();
t.string('failure').notNullable();
t.timestamp('timestamp').defaultTo(knex.fn.now());
});
Expand All @@ -35,7 +35,7 @@ module.exports = {
const hasBlacklistTable = await knex.schema.hasTable('black_list');
if (!hasBlacklistTable) {
await knex.schema.createTable('black_list', function (t) {
t.string('contract_tx_id').index().unique();
t.string('contract_tx_id').unique();
t.integer('failures');
});
}
Expand All @@ -46,7 +46,7 @@ module.exports = {
t.string('contract_tx_id').unique();
t.jsonb('manifest').notNullable();
t.string('bundle_tx_id');
t.string('sort_key').index();
t.string('sort_key');
t.string('signature').notNullable();
t.string('state_hash').notNullable();
t.timestamp('timestamp').defaultTo(knex.fn.now());
Expand Down

0 comments on commit 898d21d

Please sign in to comment.