Skip to content

Commit c1443b8

Browse files
committed
Fix committee fkey cascade behaviour
1 parent 61d22d3 commit c1443b8

File tree

12 files changed

+32
-11
lines changed

12 files changed

+32
-11
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Revision history for cardano-db-sync
22

3+
## 13.5.0.0
4+
- Fix a crtitical bug with committee foreign key, that could cause crashes
5+
36
## 13.4.1.0
47
- Fix consumed_by option for Byron inputs. A migration fixes old wrong values in place. [#1821]
58
- Fix only-utxo preset populating the metadata instead of the multiassets

cardano-chain-gen/cardano-chain-gen.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-chain-gen
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: A fake chain generator for testing cardano DB sync.
66
description: A fake chain generator for testing cardano DB sync.
77
homepage: https://github.com/IntersectMBO/cardano-db-sync

cardano-db-sync/cardano-db-sync.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-db-sync
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: The Cardano DB Sync node
66
description: A Cardano node that follows the Cardano chain and inserts data from the
77
chain into a PostgresQL database.

cardano-db-sync/src/Cardano/DbSync/Sync.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ dbSyncProtocols syncEnv metricsSetters tc codecConfig version bversion =
214214
case consumedFixed of
215215
Nothing -> oldActionFixes channel
216216
Just wrongEntriesSize | wrongEntriesSize == 0 -> do
217-
logInfo tracer "Found no wrong entries"
217+
logInfo tracer "Found no wrong consumed_by_tx_id entries"
218218
oldActionFixes channel
219219
Just wrongEntriesSize -> do
220220
logInfo tracer $

cardano-db-tool/cardano-db-tool.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-db-tool
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: Utilities to manage the cardano-db-sync databases.
66
description: Utilities and executable, used to manage and validate the
77
PostgreSQL db and the ledger database of the cardano-db-sync node

cardano-db/cardano-db.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-db
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: A base PostgreSQL component for the cardano-db-sync node.
66
description: Code for the Cardano DB Sync node that is shared between the
77
cardano-db-node and other components.

cardano-db/src/Cardano/Db/Schema.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ share
641641
quorumDenominator Word64
642642

643643
CommitteeMember
644-
committeeId CommitteeId -- here intentionally we use foreign keys
644+
committeeId CommitteeId OnDeleteCascade -- here intentionally we use foreign keys
645645
committeeHashId CommitteeHashId noreference
646646
expirationEpoch Word64 sqltype=word31type
647647

cardano-db/test/cardano-db-test.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-db-test
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: Tests for the base functionality of the cardano-db library
66
description: Code for the Cardano DB Sync node that is shared between the
77
cardano-db-node and other components.

cardano-smash-server/cardano-smash-server.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cabal-version: 3.6
22

33
name: cardano-smash-server
4-
version: 13.4.1.0
4+
version: 13.5.0.0
55
synopsis: The Cardano smash server
66
description: Please see the README on GitHub at
77
<https://github.com/IntersectMBO/cardano-db-sync/cardano-smash-server/#readme>

doc/schema.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Schema Documentation for cardano-db-sync
22

3-
**Note:** This file is auto-generated from the documentation in cardano-db/src/Cardano/Db/Schema.hs by the command `cabal run -- gen-schema-docs doc/schema.md`. This document should only be updated during the release process and updated on the release branch.
4-
53
### `schema_version`
64

75
The version of the database schema. Schema versioning is split into three stages as detailed below. This table should only ever have a single row.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ services:
5454
max-file: "10"
5555

5656
cardano-db-sync:
57-
image: ghcr.io/intersectmbo/cardano-db-sync:13.4.0.0
57+
image: ghcr.io/intersectmbo/cardano-db-sync:13.5.0.0
5858
environment:
5959
- DB_SYNC_CONFIG=${DB_SYNC_CONFIG:-}
6060
- DISABLE_LEDGER=${DISABLE_LEDGER}

schema/migration-2-0043-20240828.sql

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Persistent generated migration.
2+
3+
CREATE FUNCTION migrate() RETURNS void AS $$
4+
DECLARE
5+
next_version int ;
6+
BEGIN
7+
SELECT stage_two + 1 INTO next_version FROM schema_version ;
8+
IF next_version = 43 THEN
9+
EXECUTE 'ALTER TABLE "committee_member" DROP CONSTRAINT "committee_member_committee_id_fkey"' ;
10+
EXECUTE 'ALTER TABLE "committee_member" ADD CONSTRAINT "committee_member_committee_id_fkey" FOREIGN KEY("committee_id") REFERENCES "committee"("id") ON DELETE CASCADE ON UPDATE RESTRICT' ;
11+
-- Hand written SQL statements can be added here.
12+
UPDATE schema_version SET stage_two = next_version ;
13+
RAISE NOTICE 'DB has been migrated to stage_two version %', next_version ;
14+
END IF ;
15+
END ;
16+
$$ LANGUAGE plpgsql ;
17+
18+
SELECT migrate() ;
19+
20+
DROP FUNCTION migrate() ;

0 commit comments

Comments
 (0)