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.

Databases and drivers

TypeORM supports multiple databases, and to work with them it uses Drivers. Drivers organize TypeORM communication with specific database management system.

Supported databases

TypeORM supports multiple databases:

Database driver package installation

Each database requires you to install its own driver package:

Driver options

Driver options is a required attribute of Connection Options. Settings in the database options are required to establish connection with the database.


export interface DriverOptions {

    /**
     * Database type. This value is required.
     */
    readonly type: "mysql"|"postgres"|"mariadb"|"sqlite"|"oracle"|"mssql"|"websql";

    /**
     * Connection url to where perform connection to.
     */
    readonly url?: string;

    /**
     * Database host.
     */
    readonly host?: string;

    /**
     * Database host port.
     */
    readonly port?: number;

    /**
     * Database username.
     */
    readonly username?: string;

    /**
     * Database password.
     */
    readonly password?: string;

    /**
     * Database name to connect to.
     */
    readonly database?: string;

    /**
     * Connection SID (used for Oracle databases).
     */
    readonly sid?: string;

    /**
     * Storage type or path to the storage (used for SQLite databases).
     */
    readonly storage?: string;

    /**
     * Indicates if connection pooling should be used or not.
     * Be default it is enabled if its supported by a platform. Set to false to disable it.
     */
    readonly usePool?: boolean;

    /**
     * Extra connection options to be passed to the driver.
     */
    readonly extra?: any;

    /**
     * Prefix to use on all tables of this connection in the database.
     */
    readonly tablesPrefix?: string;

};
        

type in the driver options is required. Here you set what database do you want to use. Other options maybe required too, depend on selected driver.

You may want to setup your database driver with specific configuration options that driver package provides. To do this you need to use extra option. All your driver package's options should go there.

Fork me on GitHub