I no longer use VS Code and have no intention to actively maintain this extension. If you notice any differences between this extension and the official DBML language, please submit a PR with a fix. I will happily review, merge, and release any fixes. Thanks!
This Visual Studio Code extension provides language support for the Database Markup Language (DBML).
Syntax highlighting is enabled for files with the .dbml
extension.
When focusing a .dbml
file, the DBML: To SQL
command becomes available in the command palette. This command leverages the @dbml/core
(source) package to generate an SQL script based on the provided schema.
Selecting this commands presents all available dialects. At this time the three available dialects are PostgreSQL, MySQL, and SQL Server. After choosing a dialect, enter an output filename. If a relative path is provided, the generated file will be placed relative to the focused .dbml
file. Otherwise is will be placed at the provided absolute path.
When focusing a .sql
file, the DBML: From SQL
command appears in the command palette. This command acts as the opposite of the DBML: To SQL
command and generates a .dbml
from from the provided .sql
file. The dialect of the SQL must be provided. At this time, this command only works for PostgreSQL and MySQL.
Snippets are provided for quickly creating tables, enums, and references. To use a snippet, begin typing any of the following keys.
table
: Create a new table with an auto-incrementing int id as the primary keyenum
: Create a new enumoto
: Create a one-to-one referenceotm
: Create a one-to-many referencemto
: Create a many-to-one referencemtm
: Create a many-to-many join table
If you find an error or bug, please create an issue.
If you want to add to this project, feel free to fork the repository and submit a pull request.