Skip to content

Commit

Permalink
fix: use indexes on checkpoint table
Browse files Browse the repository at this point in the history
  • Loading branch information
Sekhmet committed Feb 26, 2024
1 parent b68a1d9 commit 6f8632f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stores/checkpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export class CheckpointsStore {
if (!hasCheckpointsTable) {
builder = builder.createTable(Table.Checkpoints, t => {
t.string(Fields.Checkpoints.Id, CheckpointIdSize).primary();
t.bigint(Fields.Checkpoints.BlockNumber).notNullable();
t.string(Fields.Checkpoints.ContractAddress, 66).notNullable();
t.bigint(Fields.Checkpoints.BlockNumber).notNullable().index();
t.string(Fields.Checkpoints.ContractAddress, 66).notNullable().index();
});
}

Expand Down
2 changes: 2 additions & 0 deletions test/unit/stores/__snapshots__/checkpoints.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

exports[`CheckpointsStore createStore should execute correct query 1`] = `
"create table \`_checkpoints\` (\`id\` varchar(10), \`block_number\` bigint not null, \`contract_address\` varchar(66) not null, primary key (\`id\`));
create index \`_checkpoints_block_number_index\` on \`_checkpoints\` (\`block_number\`);
create index \`_checkpoints_contract_address_index\` on \`_checkpoints\` (\`contract_address\`);
drop table if exists \`_metadatas\`;
create table \`_metadatas\` (\`id\` varchar(20), \`value\` varchar(128) not null, primary key (\`id\`));
drop table if exists \`_template_sources\`;
Expand Down

0 comments on commit 6f8632f

Please sign in to comment.