Skip to content

mattmeyers/vscode-dbml

Repository files navigation

DBML Language Support

Version 0.3.5 Badge MIT License Badge

This Visual Studio Code extension provides language support for the Database Markup Language (DBML).

Syntax Highlighting

Syntax highlighting is enabled for files with the .dbml extension.

Syntax Example

Commands

To SQL

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.

From SQL

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

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 key
  • enum: Create a new enum
  • oto: Create a one-to-one reference
  • otm: Create a one-to-many reference
  • mto: Create a many-to-one reference
  • mtm: Create a many-to-many join table

Issues

If you find an error or bug, please create an issue.

Contributing

If you want to add to this project, feel free to fork the repository and submit a pull request.