SQL backing for the travetto model module, with real-time modeling support for SQL schemas.
npm install @travetto/model-sqlInstall: @travetto/model-sql
``bash
npm install @travetto/model-sql
yarn add @travetto/model-sql
`
The current SQL client support stands at:
* MySQL Model Service - MySQL 8.6+
* PostgreSQL Model Service - Postgres 14+
* SQLite Model Service - (bettersqlite 8.0+)
* SQL Server - Currently unsupportedOracle
* - Currently unsupported
Note: Wider client support will roll out as usage increases.
The primary difference is around unique identifiers, and how parent/child relationships are managed. In a normal database primary keys could be composite values between various fields. For example a unique identifier could be a combination of date + orderNumber + customerNumber`. This is perfectly normal in a relational model, but SQL Model Service assumes unique identifiers (UUID) as 32-character hexadecimal values. In addition to these unique values, the parent's identifier is required in all children values. This allows for some fairly optimized querying, updates, and deletions on changes.
What this translates to, is that the framework here dictates the final schema, and doesn't support adapting to existing relational data stores. In greenfield projects, this is not an issue, but will most likely preclude its use in adapting to existing relational data sets.