
Show HN: DBML – simple DSL language to document database schemas - huy
https://www.dbml-lang.org/
======
huy
OP here. Sharing a bit of history on DBML.

Originated from dbdiagram.io, a simple tool that we built to help you draw ER
diagram by using writing code [1]. We shared that project on HN about a year
back. Since then it has been growing organically and reach over 80k users.

When we launched, what our users like most about that tool is the ability to
write simple DSL language and get the chart visualized. Then over time, we
started to see our users using that DSL language to document their internal
database structure (without the necessary need to visualize it). They were
using it as a database documentation/definition language.

Realized this is something we can add more value to the community, DBML was
then born as a simple language to help you design, document and communicate
your database structure with other developers. DBML is also open-sourced and
would welcome contributions [2].

Basically with DBML you can: \- Have a simple db.dbml file to document your
database schemas, with proper context and descriptions \- Your dbml file
becomes the central source of truth of your database definition \- Using
simple CLI command to generate SQL creation file from DBML

[1]
[https://news.ycombinator.com/item?id=18066881](https://news.ycombinator.com/item?id=18066881)

[2] [http://github.com/holistics/dbml](http://github.com/holistics/dbml)

~~~
RobGoretsky
Given that this is a declarative language, have you given thought to creating
a means of generating the (imperative) DDL needed to alter tables if the DBML
is updated? My team has been storing DDL in our GitHub repo and we have a
basic script run by our CI/CD tool to deploy that DDL upon push to master, but
it would be great if that could be extended to handle cases where the DDL is
modified.

~~~
huy
That’s a great idea. We’ll certainly consider it in the near future.

------
LandR
Is the name going to cause confusion with Microsofts DBML in .NET?

They are both database tooling?

~~~
huy
It might. But we hope it'll get more popular than Microsoft .NET DBML

------
jonathanleek
Any chance we could get syntax support in Sublime Text?

------
tole42
I really like the connected database visualiser (dbdiagram.io)

------
rraghur
Very nice! So do you plan to support other dbs? Sqlite would be nice.

~~~
huy
Yes we do. SQLite is in the roadmap.

Although it’s database-agnostic, we do realize that a lot of the use cases is
about generating database-specific SQL based on DBML code. So we’re working on
introducing dialects to the syntax so that it closely resembles specific DB
better (e.g this DBML is of MySQL dialect).

~~~
shrutipathak
That's exactly what i was wondering. DBML should totally be agnostic so i
could use with any DB i wish.

~~~
rraghur
I meant the CLI tools listed on the site that let you roundtrip between dbml
and actual sql dialect (currently looks like pgsql & mysql are supported)

I guess my original query could've been clearer - but the author got my drift
:)

------
pouta
How does this handle migrations?

~~~
huy
It doesn't yet.

