hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
186 stars 55 forks source link

warning: `no such table: ledger` #324

Closed GuutBoy closed 2 months ago

GuutBoy commented 3 months ago

Running the latest version of ordhook get the following warning over and over:

Jun 22 14:03:07.284 WARN unable to prepare query
        SELECT inscription_id, inscription_number, ordinal_number, block_height, tx_index, tick, address, avail_balance, trans_balance, operation
        FROM ledger
        WHERE ordinal_number = ? AND operation = 'transfer'
            AND NOT EXISTS (
                SELECT 1 FROM ledger WHERE ordinal_number = ? AND operation = 'transfer_send'
            )
        LIMIT 1
    : no such table: ledger

I am guessing there is some problem where the old db is not compatible with some new change. Is there some way to migrate to the new version. I do I need to delete the old dbs and generate everything from scratch?

GuutBoy commented 3 months ago

Well, turns out starting over with an empty data directory does not seem to be the solution. I still get the above warning. I see there is a new BRC-20 sqlite db. But this does not have any tables, I suppose this is related to this problem.

GuutBoy commented 3 months ago

So the hack that seems to fix this for me was to download and extract https://archive.hiro.so/mainnet/ordhook/mainnet-ordhook-brc20-latest.tar.gz into a new empty data directory. Then run ordhook db sync. IDK, maybe there is a better way ...

MikeC-BC commented 2 months ago

I'm having the same problem after downloading the rocksdb snapshot from https://archive.hiro.so/mainnet/ordhook/. Did you first run ordhook db sync and then ordhook service start ?