Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(store-sync,store-indexer): make last updated block number not null #1972

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

holic
Copy link
Member

@holic holic commented Nov 29, 2023

following up #1965

not strictly a bug but just doing this for completeness so we don't have to sort inline

Copy link

changeset-bot bot commented Nov 29, 2023

🦋 Changeset detected

Latest commit: fe69511

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 30 packages
Name Type
@latticexyz/store-indexer Major
@latticexyz/store-sync Major
@latticexyz/dev-tools Major
@latticexyz/abi-ts Major
@latticexyz/block-logs-stream Major
@latticexyz/cli Major
@latticexyz/common Major
@latticexyz/config Major
create-mud Major
@latticexyz/ecs-browser Major
@latticexyz/faucet Major
@latticexyz/gas-report Major
@latticexyz/network Major
@latticexyz/noise Major
@latticexyz/phaserx Major
@latticexyz/protocol-parser Major
@latticexyz/react Major
@latticexyz/recs Major
@latticexyz/schema-type Major
@latticexyz/services Major
@latticexyz/solecs Major
solhint-config-mud Major
solhint-plugin-mud Major
@latticexyz/std-client Major
@latticexyz/std-contracts Major
@latticexyz/store-cache Major
@latticexyz/store Major
@latticexyz/utils Major
@latticexyz/world-modules Major
@latticexyz/world Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@holic holic changed the title make last updated block number not null, for easier sorting fix(store-sync,store-indexer): make last updated block number not null, for easier sorting Nov 29, 2023
@holic holic changed the title fix(store-sync,store-indexer): make last updated block number not null, for easier sorting fix(store-sync,store-indexer): make last updated block number not null Nov 29, 2023
@@ -53,7 +53,8 @@ export async function getLogs(
const records = await database
.select()
.from(tables.recordsTable)
.where(or(...conditions));
.where(or(...conditions))
.orderBy(asc(tables.recordsTable.lastUpdatedBlockNumber));
Copy link
Member Author

@holic holic Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

originally had this as

.orderBy(sql`${tables.recordsTable.lastUpdatedBlockNumber} ASC NULLS FIRST`)

but then realize there's ~no case where we'd add records to the table without a block number (both RPC and another indexer will provide this info)

so I decided to make these fields not nullable

@holic holic marked this pull request as ready for review November 29, 2023 14:08
@holic holic requested a review from alvrs as a code owner November 29, 2023 14:08
@holic holic merged commit 504e25d into main Nov 29, 2023
10 checks passed
@holic holic deleted the holic/postgres-block-number-not-null branch November 29, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants