Skip to content

Commit a3098e0

Browse files
committed
update docmentation for db-tool for address table schema
1 parent 1b5b4fa commit a3098e0

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

doc/schema-management.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ indexes during syncing slows down db-sync and so they are added later. Index
1515
creation is idempotent and the `schema_version.stage_tree` field is ignored.
1616
These files cannot be modified but they can be extended, in case users want to
1717
introduce their own indexes from the begining.
18-
- `stage 4`: introduces all the other indexes. By default these are the indexes
19-
that were created by previous db-sync versions. This stage is executed when
20-
db-sync has reached 30mins before the tip of the chain. It is advised to increase
21-
the `maintenance_work_mem` from Postgres config to 0.5GB - 1GB to speed this
22-
process (default is 64MB). Also use the default (2) or higher
23-
`max_parallel_maintenance_workers`. These files can be modified or extended
24-
by users.
18+
- `stage 4`: introduces all the other indexes. By default these are the indexes that were created by previous db-sync versions. This stage is executed when
19+
db-sync has reached 30mins before the tip of the chain. It is advised to increase the `maintenance_work_mem` from Postgres config to 0.5GB - 1GB to speed this
20+
process (default is 64MB).
21+
Also use the default (2) or higher `max_parallel_maintenance_workers`. These files can be modified or extended
22+
by users.
2523

2624
All of the schema migrations in these three stages are written to be idempotent (so that they
2725
"know" if they have already been applied).
@@ -34,6 +32,11 @@ where the `1` denotes "stage 1" of the SQL migration, the `0000` is the migratio
3432
last number is the date. Listing the directory containing the schema and sorting the list will
3533
order them in the correct order for applying to the database.
3634

35+
Since the introduction of `use_address_table` [config](https://github.com/IntersectMBO/cardano-db-sync/blob/master/doc/configuration.md#tx-out). The file `migration-4-001-*` when indexing will not be ran when the this configuration is active.
36+
37+
There is also a flag you can use in cardano-db-tool `--use-tx-out-address` which handles the alternate variation of the schema, one might be using.
38+
39+
3740
## Creating a Migration
3841

3942
Whenever the Haskell schema definition in `Cardano.Db.Schema` is updated, a schema migration will need to be migrated.
@@ -52,6 +55,12 @@ cabal run cardano-db-tool -- create-migration --mdir schema/
5255
```
5356
This will generate a migration if one is needed.
5457

58+
There is an alternate way to create/run a migration when using the `use_txout_address` configuration as previously mentioned, this uses a different variation of the schema.
59+
To do this, you simply add the flag `--use-tx-out-address` like so:
60+
```
61+
PGPASSFILE=config/pgpass-mainnet cabal run cardano-db-tool -- create-migration --use-tx-out-address --mdir schema/
62+
```
63+
5564
Once this has completed it's good practice to rebuild `cardano-db-sync` due to how it caches schema files when built, this can be done using the following documentation [Build and Install](./installing.md#build-and-install)
5665

5766
**Note:** For extra reassurance one can run the test suite to check that the new migration hasn't broken any tests:

0 commit comments

Comments
 (0)