Skip to content

Commit

Permalink
Switch bytes to Maybe ByteString to allow nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed May 12, 2022
1 parent ed1b903 commit 3af3589
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cardano-db-sync/src/Cardano/DbSync/Era/Shelley/Insert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ insertDatum tracer txId txd = do
{ DB.datumHash = Generic.txDatumHash txd
, DB.datumTxId = txId
, DB.datumValue = value
, DB.datumBytes = Generic.txDatumBytes txd
, DB.datumBytes = Just $ Generic.txDatumBytes txd
}

insertTxMetadata
Expand Down
2 changes: 1 addition & 1 deletion cardano-db/src/Cardano/Db/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ share
hash ByteString sqltype=hash32type
txId TxId OnDeleteCascade
value Text Maybe sqltype=jsonb
bytes ByteString sqltype=bytea
bytes ByteString Maybe sqltype=bytea
UniqueData hash

-- -----------------------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion schema/migration-2-0006-20220509.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ DECLARE
BEGIN
SELECT stage_two + 1 INTO next_version FROM schema_version ;
IF next_version = 6 THEN
EXECUTE 'ALTER TABLE "datum" ADD COLUMN "bytes" bytea NOT NULL' ;
EXECUTE 'ALTER TABLE "datum" ADD COLUMN "bytes" bytea' ;

-- Hand written SQL statements can be added here.
UPDATE schema_version SET stage_two = next_version ;
RAISE NOTICE 'DB has been migrated to stage_two version %', next_version ;
Expand Down

0 comments on commit 3af3589

Please sign in to comment.