You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/schema-management.md
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -15,13 +15,11 @@ indexes during syncing slows down db-sync and so they are added later. Index
15
15
creation is idempotent and the `schema_version.stage_tree` field is ignored.
16
16
These files cannot be modified but they can be extended, in case users want to
17
17
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.
25
23
26
24
All of the schema migrations in these three stages are written to be idempotent (so that they
27
25
"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
34
32
last number is the date. Listing the directory containing the schema and sorting the list will
35
33
order them in the correct order for applying to the database.
36
34
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
+
37
40
## Creating a Migration
38
41
39
42
Whenever the Haskell schema definition in `Cardano.Db.Schema` is updated, a schema migration will need to be migrated.
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
+
55
64
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)
56
65
57
66
**Note:** For extra reassurance one can run the test suite to check that the new migration hasn't broken any tests:
0 commit comments