eos icon indicating copy to clipboard operation
eos copied to clipboard

How to delete a row in multi index table after upgrading a contract?

Open NeverLandFly opened this issue 8 years ago • 3 comments

I insert a row in the target table, then upgrade the contract. After that i failed to insert a row with the same primary key. The error is:

could not insert object, most likely a uniqueness constraint was violated (13)

If I try to delete the old row first, the nodeos suggest:

3050003 eosio_assert_message_exception: eosio_assert_message assertion failure assertion failure with message: read {"s":"read"} That's the read only error, right? Then how can I clear the table and use it in the upgraded contract?

NeverLandFly avatar Aug 08 '18 01:08 NeverLandFly

You need to reverse your contract with the old struct layout then delete by key.

taokayan avatar Aug 08 '18 09:08 taokayan

@taokayan how to reverse the contract?

fyy000 avatar Aug 08 '18 09:08 fyy000

+1

flyq avatar Dec 04 '18 11:12 flyq