Database Profiles
Database profiles map abstract model types to vendor-specific concrete types with parameterised templates, naming conventions, and fidelity loss detection. Design your model once and generate correct DDL for any database vendor, with built-in vendor templates covering SQL Server, PostgreSQL, MySQL, Oracle, MongoDB, SQLite, Snowflake, MariaDB, CockroachDB, Azure Table Storage, Azure Cosmos DB, Amazon DynamoDB, and Apache Cassandra.
A model property with abstract type string means different things to different databases. In SQL Server, it is NVARCHAR(255). In PostgreSQL, it is VARCHAR(255) or TEXT. In MongoDB, it is simply String. Without a translation layer, architects must either pick a vendor upfront and lose portability, or maintain separate schema definitions for each target database.
Database profiles provide that translation layer. Each profile defines a mapping from abstract types to concrete database types, a naming convention for tables and columns, and parameterised templates that use property constraints to generate precise DDL types. The model stays vendor-agnostic. The profile handles the vendor-specific details.
Abstract Type Mappings
Each profile maps abstract types to concrete types for a specific database vendor.
| Abstract Type | SQL Server | PostgreSQL | MySQL | Oracle | MongoDB |
|---|---|---|---|---|---|
| string | NVARCHAR({maxLength}) | VARCHAR({maxLength}) | VARCHAR({maxLength}) | VARCHAR2({maxLength}) | String |
| text | NVARCHAR(MAX) | TEXT | LONGTEXT | CLOB | String |
| integer | INT | INTEGER | INT | NUMBER(10) | Number |
| float | FLOAT | DOUBLE PRECISION | DOUBLE | BINARY_DOUBLE | Number |
| decimal | DECIMAL({precision},{scale}) | NUMERIC({precision},{scale}) | DECIMAL({precision},{scale}) | NUMBER({precision},{scale}) | Decimal128 |
| boolean | BIT | BOOLEAN | TINYINT(1) | NUMBER(1) | Boolean |
| date | DATE | DATE | DATE | DATE | Date |
| datetime | DATETIME2 | TIMESTAMPTZ | DATETIME(6) | TIMESTAMP | Date |
| uuid | UNIQUEIDENTIFIER | UUID | CHAR(36) | RAW(16) | String |
| json | NVARCHAR(MAX) | JSONB | JSON | CLOB | Object |
| binary | VARBINARY(MAX) | BYTEA | LONGBLOB | BLOB | BinData |
| enum | NVARCHAR(50) | TEXT | ENUM(...) | VARCHAR2(50) | String |
Parameterised Templates
Type mappings use parameterised templates that substitute values from property constraints. This allows the concrete type to adapt to each property's specific requirements.
| Template Variable | Source | Fallback | Example |
|---|---|---|---|
| {maxLength} | property.maxLength | MAX | NVARCHAR(255) when maxLength=255, NVARCHAR(MAX) when unset |
| {minLength} | property.minLength | - | Used in CHECK constraints |
| {precision} | property.maxValue | - | DECIMAL(18,2) when maxValue=18 |
| {scale} | property.scale | 2 | DECIMAL(18,4) when scale=4 |
| {minValue} | property.minValue | - | Used in CHECK constraints |
| {maxValue} | property.maxValue | - | Used in CHECK constraints |
Naming Conventions
Each profile defines a naming convention that controls how entity and property names from the model are transformed when displayed in Data Views or exported as DDL.
| Convention | Model Name | Resolved Name | Default Vendor |
|---|---|---|---|
| PascalCase | order_item | OrderItem | SQL Server |
| snake_case | orderItem | order_item | PostgreSQL, MySQL |
| SCREAMING_SNAKE_CASE | orderItem | ORDER_ITEM | Oracle |
| camelCase | OrderItem | orderItem | MongoDB |
| kebab-case | OrderItem | order-item | - |
| Train-Case | orderItem | Order-Item | - |
| dot.case | orderItem | order.item | - |
| flatcase | OrderItem | orderitem | - |
| UPPERFLATCASE | orderItem | ORDERITEM | - |
| none | orderItem | orderItem (unchanged) | - |
Fidelity Loss Detection
Not all databases support all features equally. When switching from one database profile to another, the system checks for fidelity loss and warns about potential issues.
| Fidelity Issue | Example | Severity |
|---|---|---|
| Missing type mapping | Abstract type has no concrete type in the target profile | Error |
| Text-based UUID | MySQL uses CHAR(36) instead of a native UUID type | Warning |
| Text-based JSON | SQL Server uses NVARCHAR(MAX) instead of native JSONB | Warning |
| No native enum support | PostgreSQL uses TEXT instead of ENUM for enum types | Info |
| Emulated boolean | MySQL uses TINYINT(1) instead of a native BOOLEAN type | Info |
Profile File Format
Database profiles are stored as .neoarc-db-profile.json files in the project. Each profile is self-contained with all type mappings and conventions.
Resolution Flow
When a persistence mode Data View renders an entity, the following resolution chain applies: