This is a simple example of how to use the DB Schema Gen to generate types from a database schema.
- Run
npm install db-schema-gen
oryarn add db-schema-gen
- Create a
.json
config file with the following contents:
{
"language": "postgresql",
"outputDir": "types",
"url": "YOUR_CONNECTION_STRING",
"options": {
"namespace": "DB",
"columnCase": "camel"
}
}
- Run
db-schema-gen --config YOUR_CONFIG_FILE.json
- Enjoy your generated types!