Skip to content

Commit

Permalink
Fix migration error on checkpoint table
Browse files Browse the repository at this point in the history
SQLite doesn't support removing columns, so we put them back as
"unused" fields.

https://www.sqlite.org/lang_altertable.html#altertableishard

Closes #1621
  • Loading branch information
rvl committed May 5, 2020
1 parent 76f0c97 commit d2248ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/core/src/Cardano/Wallet/DB/Sqlite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,8 @@ mkCheckpointEntity wid wal =
, checkpointEpochStability = coerce (bp ^. #getEpochStability)
, checkpointActiveSlotCoeff =
W.unActiveSlotCoefficient (bp ^. #getActiveSlotCoefficient)
, checkpointFeePolicyUnused = ""
, checkpointTxMaxSizeUnused = 0
}
utxo =
[ UTxO wid sl (TxId input) ix addr coin
Expand Down Expand Up @@ -776,8 +778,10 @@ checkpointFromEntity cp utxo s =
bh
(BlockId genesisHash)
genesisStart
_feePolicyUnused
slotLength
epochLength
_txMaxSizeUnused
epochStability
activeSlotCoeff
) = cp
Expand Down
2 changes: 2 additions & 0 deletions lib/core/src/Cardano/Wallet/DB/Sqlite/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,10 @@ Checkpoint
checkpointBlockHeight Word32 sql=block_height
checkpointGenesisHash BlockId sql=genesis_hash
checkpointGenesisStart UTCTime sql=genesis_start
checkpointFeePolicyUnused Text sql=fee_policy
checkpointSlotLength Word64 sql=slot_length
checkpointEpochLength Word32 sql=epoch_length
checkpointTxMaxSizeUnused Word16 sql=tx_max_size
checkpointEpochStability Word32 sql=epoch_stability
checkpointActiveSlotCoeff Double sql=active_slot_coeff

Expand Down

0 comments on commit d2248ed

Please sign in to comment.