TypeORM

TypeORM - data-mapper ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, WebSQL databases. Works in Node.JS and Browser.

Relations

With TypeORM you can create one-to-one, many-to-one, one-to-many, many-to-many relations easily.

Relation decorators

Relation options


export interface RelationOptions {

    /**
     * If set to true then it means that related object can be allowed to be inserted / updated / removed to the db.
     * This is option a shortcut if you would like to set cascadeInsert, cascadeUpdate and cascadeRemove to true.
     */
    readonly cascadeAll?: boolean;

    /**
     * If set to true then it means that related object can be allowed to be inserted to the db.
     */
    readonly cascadeInsert?: boolean;

    /**
     * If set to true then it means that related object can be allowed to be updated in the db.
     */
    readonly cascadeUpdate?: boolean;

    /**
     * If set to true then it means that related object can be allowed to be remove from the db.
     */
    readonly cascadeRemove?: boolean;

    /**
     * Database cascade action on delete.
     */
    readonly onDelete?: "RESTRICT"|"CASCADE"|"SET NULL";

}
        

Cascade operations

You can use mutliple cascade operations:

Fork me on GitHub