Which Database Dialects Does DrawDB Support? Complete 2024 Guide
DrawDB supports seven database dialects: MySQL, PostgreSQL, SQLite, MariaDB, MSSQL (Transact-SQL), Oracle SQL, and a generic fallback dialect.
DrawDB is an open-source database diagramming tool that generates SQL schemas from visual designs. Knowing which database dialects DrawDB supports is essential for developers who need accurate type mappings, feature detection, and export compatibility. This guide examines the dialect registry implemented in the DrawDB source code, explains how feature flags control UI behavior, and shows practical code examples for working with the catalog.
Supported Database Dialects in DrawDB
The complete list of supported dialects lives in src/data/databases.js, with identifiers defined as a DB enum in src/data/constants.js. Each entry includes metadata flags that enable or disable database-specific features in the interface.
MySQL and MariaDB
- Identifiers:
DB.MYSQLandDB.MARIADB - Key feature:
hasUnsignedTypes: true
Both MySQL and MariaDB support unsigned integer types, which appear as a checkbox in DrawDB's column editor. The dialect definitions distinguish these from other databases that lack unsigned numeric variants.
PostgreSQL
- Identifier:
DB.POSTGRES - Key features:
hasTypes: true,hasEnums: true,hasArrays: true
PostgreSQL receives the richest feature support. DrawDB exposes custom type definitions, enumerated types, and array columns exclusively when this dialect is selected. The hasArrays flag is unique to PostgreSQL in the current catalog.
SQLite
- Identifier:
DB.SQLITE - Key features: Basic schema support,
hasTypes: false
SQLite operates with strict type affinity rules rather than custom types. DrawDB simplifies its type selection UI accordingly, omitting advanced type options that SQLite does not enforce at the storage level.
MSSQL (Transact-SQL)
- Identifier:
DB.MSSQL - Key features: Basic support with standard type mappings
Microsoft SQL Server dialect support covers core schema generation without specialized flags for advanced T-SQL features like user-defined table types or CLR integration.
Oracle SQL
- Identifier:
DB.ORACLESQL - Key features:
beta: true
Oracle support carries a beta indicator signaling experimental implementation. Developers should verify generated SQL against actual Oracle databases, as edge cases in PL/SQL-specific syntax may not be fully handled.
Generic Dialect
- Identifier:
DB.GENERIC - Key features:
hasTypes: true(fallback behavior)
The generic dialect serves as a universal fallback when no specific database is targeted. It enables full type support without database-specific constraints, useful for conceptual modeling or export to multiple platforms.
How the Dialect Catalog Works
DrawDB implements its dialect registry as a Proxy object that returns an empty object for unknown keys. This pattern prevents runtime errors when code requests an undefined dialect.
Source Structure
// src/data/constants.js - Database identifiers
export const DB = Object.freeze({
MYSQL: "mysql",
POSTGRES: "postgres",
SQLITE: "sqlite",
MARIADB: "mariadb",
MSSQL: "mssql",
GENERIC: "generic",
ORACLESQL: "oraclesql",
});
// src/data/databases.js - Usage pattern
import { DB } from "./constants";
const databases = new Proxy(target, handler);
// Access pattern: databases[DB.MYSQL] → MySQL definition
Feature Flag System
Each dialect entry contains boolean flags that drive conditional UI rendering:
| Flag | Purpose | Dialects Enabled |
|---|---|---|
hasTypes |
Show custom type selector | PostgreSQL, Generic |
hasUnsignedTypes |
Show "Unsigned" checkbox | MySQL, MariaDB |
hasEnums |
Enable enum type creation | PostgreSQL |
hasArrays |
Allow array column types | PostgreSQL |
beta |
Display warning badge | Oracle SQL |
According to the DrawDB source code, these flags are consumed by components like src/components/CodeEditor/setUpDBML.js to populate dialect selectors and by import utilities in src/utils/importSQL/ to parse database-specific syntax.
Working with the Dialect Registry
Retrieving Dialect Information
import { databases } from "./src/data/databases";
import { DB } from "./src/data/constants";
// Get metadata for a specific database
const postgres = databases[DB.POSTGRES];
console.log(postgres.name); // → "PostgreSQL"
console.log(postgres.hasArrays); // → true
// Safe lookup returns empty object for invalid keys
const unknown = databases["nonexistent"];
console.log(unknown); // → {}
Iterating All Supported Dialects
Object.values(databases).forEach((dialect) => {
console.log(
`${dialect.name}${dialect.beta ? " (beta)" : ""} — ` +
`types: ${dialect.hasTypes}, unsigned: ${dialect.hasUnsignedTypes}`
);
});
Integration in UI Components
The dialect catalog integrates with DrawDB's internationalization system. The generic dialect pulls its display name from i18n.t("generic"), ensuring consistent localization across supported languages:
// Pattern found in src/data/databases.js
const genericDialect = {
name: i18n.t("generic"),
label: DB.GENERIC,
hasTypes: true,
// ...
};
Version and Compatibility Notes
DrawDB's dialect support has stabilized across recent releases. The beta flag on Oracle SQL indicates active development, while MySQL, PostgreSQL, and SQLite represent mature, production-ready implementations. For schema import functionality, examine src/utils/importSQL/sqlite.js and sibling files to understand how dialect-specific parsing extends the core catalog.
Summary
- DrawDB supports seven database dialects: MySQL, PostgreSQL, SQLite, MariaDB, MSSQL, Oracle SQL, and Generic
- Dialects are defined in
src/data/databases.jswith identifiers fromsrc/data/constants.js - Feature flags (
hasTypes,hasUnsignedTypes,hasEnums,hasArrays,beta) control UI availability - The catalog uses a Proxy pattern for safe undefined key access
- PostgreSQL receives the most feature support including arrays and enums
- Oracle SQL carries a beta designation for experimental support
Frequently Asked Questions
How do I add a new database dialect to DrawDB?
To add a new dialect, modify src/data/constants.js to add a DB enum entry, then define the dialect metadata in src/data/databases.js with appropriate feature flags. You must also implement any dialect-specific import logic in src/utils/importSQL/ and verify UI components handle the new dialect correctly.
Why does DrawDB show different type options for different databases?
DrawDB uses feature flags on each dialect definition to conditionally render controls. Only PostgreSQL shows array and enum options because only databases[DB.POSTGRES] sets hasArrays: true and hasEnums: true. This prevents users from selecting unsupported type combinations.
What happens if I select a database dialect not in the official list?
The dialect catalog is a JavaScript Proxy that returns an empty object for unknown keys. Code consuming databases[unknownKey] receives {}, which typically renders as a no-op or default case rather than throwing an error. DrawDB falls back to generic behavior rather than crashing.
Is Oracle SQL production-ready in DrawDB?
Oracle SQL support carries a beta: true flag in the source code, indicating experimental status. Generated schemas should be validated against actual Oracle databases before production deployment, particularly for PL/SQL-specific syntax and data type edge cases.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →