Generate DBML from JS object
- Dominant language
- JavaScript
- Stars
- 3.7k
- Forks
- 233
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Hi,
First, thank you for this project and the libraries <3
I have an object representing my db and I'm looking to generate DBML from it.
Looking at https://dbml.dbdiagram.io/js-module/#class-modelexporter I see I can generate DBML using:
```js
ModelExporter.export(database, 'postgres', false)
```
My issue is, I don't know how to generate a `database` value with `Database` type :disappointed:
In the example it's build using the parser but I don't have DBML as input.
I saw the `Database` class is exported here: [dbml-core/src/model_structure/database.js](https://github.com/holistics/dbml/blob/master/packages/dbml-core/src/model_structure/database.js), and I tried to import it using:
```js
import Database from "@dbml/core/types/model_structure/database";
```
But it gives me the error: `Cannot find module '@dbml/core/types/model_structure/database' from 'src/dbml.ts'`
And when I try:
```js
import Database from "@dbml/core/model_structure/database";
```
I got the error: `Cannot find module '@dbml/core/model_structure/database' or its corresponding type declarations.`
Do you have any idea how I can configure TypeScript to match modules and type definitions or how I can create a Database class?
I think it would be nice to export the models in `model_structure` in the `index.js`, what do you think?
Also, I don't know the difference between a Database and a NormalizedDatabase, is there any explanation somewhere?
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.