@travetto/model-sql

4.0.7 • Public • Published

SQL Model Service

SQL backing for the travetto model module, with real-time modeling support for SQL schemas.

Install: @travetto/model-sql

npm install @travetto/model-sql

# or

yarn add @travetto/model-sql

The current SQL client support stands at:

Note: Wider client support will roll out as usage increases.

Assumed Behavior

The SQL Model Service works quite a bit different than the average Object Relationship Mapping in that it makes assertions about how data is stored in the database. The primary goal of the SQL support is not to handle every scenario that a relational database can provide, but to integrate with the Data Modeling Support structure, while leverage relational datastores to the best of their abilities.

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.

Dependencies (4)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @travetto/model-sql

    Homepage

    travetto.io

    Weekly Downloads

    10

    Version

    4.0.7

    License

    MIT

    Unpacked Size

    77.8 kB

    Total Files

    13

    Last publish

    Collaborators

    • arcsine