db-exporter - application for export db schema and data to formats
Exporters
| Exporter | Description | Usage example |
|---|---|---|
grpc-crud |
Exports CRUD in .proto from database schema | |
ddl |
Exports DDL from database schema | |
csv |
Exports data from tables | |
md |
Exports database schema to Markdown | Schema ➡️ Markdown |
diagram |
Exports database schema as image of Class Diagram | |
go-entities |
Go structures with db tags | Schema ➡️ Go entities, repositories |
go-entity-repository |
Go structures with db tags and repositories | |
goose |
Goose migrations | |
goose-fixtures |
Exports data from tables as inserts to Goose migrations | |
go-sql-migrate |
Migrations for sql-migrate | |
laravel-migrations-raw |
Raw SQL Laravel migrations | |
laravel-models |
Exports database schema as Laravel models | |
json-schema |
Exports database schema to JSON Schema | |
graphql |
Exports database schema to GraphQL types | |
dbml |
Exports database schema to DBML (table, ref, enum) | |
custom |
Exports DB schema by your template with Twig syntax | Generating .txt files from a template built into the configuration |
mermaid |
Exports DB schema to Mermaid ER Diagram |
Supported database schemas:
usage:
Usage
db-exporter[--config] [--tasks]
Options
config Path to config file (yaml), default: ./.db-exporter.yaml
tasks task names of config file
Usage examples
db-exporter --config db.yaml Run db-exporter with custom config path
The exporter operates on tasks that have activities.
For example, to describe the export of a database schema to a GraphQL, the following configuration is required.
databases:
default:
driver: postgres
dsn: ${PG_DSN}
tasks:
gen_graphql:
activities:
- format: graphql
out:
dir: ./out/graphqlConfig file declared in JSON Schema
You can inject environment variables to config:
- DSN to database in
databases:databases: default: driver: postgres dsn: $PG_DSN
- Commit Author in
tasks:tasks: gen_docs: commit: author: ${COMMIT_AUTHOR} activities: ...
- Tables List in
activitiestasks: gen_csv: activities: - format: csv tables: list: ${MY_TABLES}
На русском:

