File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
cardano-db/src/Cardano/Db/Schema Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,21 @@ import qualified Cardano.Db.Schema.Variants.TxOutAddress as VA
55import qualified Cardano.Db.Schema.Variants.TxOutCore as VC
66import Cardano.Prelude (ByteString , Text )
77
8+ -- |
9+ -- This module implements a schema variants system that allows db-sync to support different
10+ -- database layouts for the same logical data. Currently used for TxOut-related tables.
11+ --
12+ -- Two variants exist:
13+ -- - Core (default): Stores address data inline in tx_out tables (denormalised)
14+ -- - Address: Normalises addresses into a separate 'address' table for storage efficiency
15+ --
16+ -- Users configure this via 'tx_out.use_address_table' in the config file (see doc/configuration.md).
17+ -- Since the schema variant is determined by runtime configuration rather than compile time,
18+ -- we cannot use the type system alone to handle the different schemas. The wrapper types
19+ -- (TxOutW, TxOutIdW, etc.) use sum types to provide runtime polymorphism, allowing code to
20+ -- work with either variant through pattern matching. This design can be extended to other
21+ -- tables following the same pattern.
22+
823--------------------------------------------------------------------------------
924-- TxOutVariantType
1025--------------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments