drawdb-io / drawdb-io/drawdb

[FEATURE] Command Line Interface (CLI) for Automated File Transformations (e.g., JSON to SQLite)

Open
#716 2 comments 1 reaction 1 assignee Claimed by @1ilit View on GitHub
Dominant language
JavaScript
Stars
39.5k
Forks
3.2k
Avg merge
10h 46m
Merged PRs (30d)
16

Description

First of all, thank you very much for this great project. I really appreciate all the work you’ve done so far.

**Is your feature request related to a problem? Please describe.**

Currently, `drawdb` offers fantastic file transformation capabilities through its intuitive web UI. Users can import various formats (like DBML, JSON or SQL) and export to others (like SQL, Mermaid, PNG, PDF, etc). However, these powerful conversion features are exclusively accessible via the graphical interface. This limitation prevents `drawdb` from being integrated into automated workflows, build processes, or CI/CD pipelines, where headless operations are essential.

**Describe the solution you'd like**

I propose adding a simple Command Line Interface (CLI) tool that allows users to access `drawdb`'s core file transformation logic programmatically.

A minimal CLI could look something like this:

```bash
drawdb convert --from --to [--format ] [--output-format ]
```

For example:

* To convert a DBML file to SQLite:
```bash
drawdb convert --from schema.dbml --to database.sqlite
```
* (Hypothetically) To convert a `drawdb` JSON file to SQL:
```bash
drawdb convert --from project.drawdb.json --to schema.sql
```

Ideally, the CLI should be able to infer the input/output formats from the file extensions, making the `--format` flags optional for common cases.

**Describe alternatives you've considered**

Currently, the only alternative is to manually use the web UI for each conversion, which is infeasible for automation and CI/CD workflows.

I also briefly examined the project's codebase, exploring a proof of concept for directly running the transformation logic with Node.js. However, I encountered a roadblock: Node.js failed to resolve `import` statements lacking file extensions (e.g., `.js`), which hindered the easy execution of the core transformation logic outside the existing build system. This indicates that it may be necessary to separate the logic from the UI code and create a dedicated library for this purpose.

**Additional context**

Implementing a CLI would greatly enhance the utility and reach of `drawdb`, transforming it into an even more powerful tool for database schema management, especially for teams embracing automation and CI/CD. It would significantly broaden the project's adoption beyond just a web-based utility to a foundational piece of a development workflow.

**Have you used AI help to write this issue?**

😉

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.