Skip to content

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

@tandiljuan

Description

@tandiljuan

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:

drawdb convert --from <input_file_path> --to <output_file_path> [--format <input_format>] [--output-format <output_format>]

For example:

  • To convert a DBML file to SQLite:
    drawdb convert --from schema.dbml --to database.sqlite
  • (Hypothetically) To convert a drawdb JSON file to SQL:
    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?

😉

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions