Before, the database schemas were defined in one directory and code generation was configured with one sqlc.yaml file. The database schema validation was only conducted against the most specific schema definition for the command that was invoked (e.g. the "collator" schema). This ignored schema changes for definitions that were used across commands, like "chainobsdb" or the keyper database definition.
Now the code generation is split up in multiple sqlc modules that have the same folder structure.
The location of the sql and sqlc files for each individual database module lies within the go package that uses the database the most.
Additionally, database definitions now comply to an interface Definition and they are created at initialisation time.
The definitions are used to initialise and validate the database. An implementation AggregateDefinition can be used to wrap multiple database module definitions in one Definition and thus combine (hierarchical) definitions into one flat set of database modules. This allows to check for the schema versions of all database modules.
Before, the database schemas were defined in one directory and code generation was configured with one
sqlc.yaml
file. The database schema validation was only conducted against the most specific schema definition for the command that was invoked (e.g. the "collator" schema). This ignored schema changes for definitions that were used across commands, like "chainobsdb" or the keyper database definition.Now the code generation is split up in multiple sqlc modules that have the same folder structure. The location of the sql and sqlc files for each individual database module lies within the go package that uses the database the most. Additionally, database definitions now comply to an interface
Definition
and they are created at initialisation time. The definitions are used to initialise and validate the database. An implementationAggregateDefinition
can be used to wrap multiple database module definitions in oneDefinition
and thus combine (hierarchical) definitions into one flat set of database modules. This allows to check for the schema versions of all database modules.