Author: @worstell
Databases are declared using discoverable file locations with a required hierarchy:
Go
JVM
A schema
subdirectory must be present in order for the DB to be extracted to the schema (and consequently provisioned).
The DB can be created manually or via CLI:
The following:
Will create the db/postgres/mydb
directory containing an empty schema
directory and config.toml
file with no contents. This database will be provisioned at the next deploy.
Users can optionally supply additional configurations in the config.toml
.
Like declaring the DB itself, users can add or update DB configs either manully or via the CLI. Something like this:
Where the following would produce the example above:
Any queries in .sql
files found in the queries.sql
subdirectory are generated into type-safe SQL verbs.
We'll also generate a handle for raw queries using the runtime-native driver. If no queries directory is present, or if the queries directory is empty, this handle is the only means to communicate with the DB.
Generated handle:
Example user code: