16 comments

[ 2.5 ms ] story [ 48.7 ms ] thread
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

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

That's brilliant, both the editor and the language. I've long designed schemata on tools like MySQL Workbench [0] which didn't make it easy to iterate with other devs before settling on a final schema but this should make it far easier!

[0] https://www.mysql.com/products/workbench/

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.
That’s a great idea. We’ll certainly consider it in the near future.
You really sell that well in your link, telling me just why it's useful compared to DDL and giving useful tools.
Very nice! So do you plan to support other dbs? Sqlite would be nice.
Apparently "DBML is database-agnostic".
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).

That's exactly what i was wondering. DBML should totally be agnostic so i could use with any DB i wish.
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 :)

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

They are both database tooling?

It might. But we hope it'll get more popular than Microsoft .NET DBML
How does this handle migrations?
It doesn't yet.
I really like the connected database visualiser (dbdiagram.io)
Any chance we could get syntax support in Sublime Text?