Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface SqljsConnectionOptions

Sql.js-specific connection options.

Hierarchy

Index

Properties

Optional autoSave

autoSave: boolean

Enables the autoSave mechanism which either saves to location or calls autoSaveCallback every time a change to the database is made.

Optional autoSaveCallback

autoSaveCallback: Function

A function that gets called on every change instead of the internal autoSave function. autoSave has to be enabled for this to work.

Optional cache

cache: boolean | object

Allows to setup cache options.

Optional cli

cli: object

CLI settings.

Type declaration

  • Optional entitiesDir?: string

    Directory where entities should be created by default.

  • Optional migrationsDir?: string

    Directory where migrations should be created by default.

  • Optional subscribersDir?: string

    Directory where subscribers should be created by default.

Optional database

database: Uint8Array

A Uint8Array that gets imported when the connection is opened.

Optional dropSchema

dropSchema: boolean

Drops the schema each time connection is being established. Be careful with this option and don't use this in production - otherwise you'll lose all production data. This option is useful during debug and development.

Optional entities

entities: (string | Function | EntitySchema<any>)[]

Entities to be loaded for this connection. Accepts both entity classes and directories where from entities need to be loaded. Directories support glob patterns.

Optional entityPrefix

entityPrefix: string

Prefix to use on all tables (collections) of this connection in the database.

Optional extra

extra: any

Extra connection options to be passed to the underlying driver.

todo: deprecate this and move all database-specific types into hts own connection options object.

Optional location

location: string

File path (Node.js) or local storage key (browser) to load and save database from. If this is specified without autoSave, the database is loaded from the location and can be saved manually via the SqljsEntityManager. If autoSave is enabled, location is used to automatically save the database.

Optional logger

logger: "advanced-console" | "simple-console" | "file" | "debug" | Logger

Logger instance used to log queries and events in the ORM.

Optional logging

logging: LoggerOptions

Logging options.

Optional maxQueryExecutionTime

maxQueryExecutionTime: number

Maximum number of milliseconds query should be executed before logger log a warning.

Optional migrations

migrations: (string | Function)[]

Migrations to be loaded for this connection. Accepts both migration classes and directories where from migrations need to be loaded. Directories support glob patterns.

Optional migrationsRun

migrationsRun: boolean

Indicates if migrations should be auto run on every application launch. Alternative to it, you can use CLI and run migrations:run command.

Optional migrationsTableName

migrationsTableName: string

Migrations table name, in case of different name from "migrations". Accepts single string name.

Optional name

name: string

Connection name. If connection name is not given then it will be called "default". Different connections must have different names.

Optional namingStrategy

namingStrategy: NamingStrategyInterface

Naming strategy to be used to name tables and columns in the database.

Optional subscribers

subscribers: (string | Function)[]

Subscribers to be loaded for this connection. Accepts both subscriber classes and directories where from subscribers need to be loaded. Directories support glob patterns.

Optional synchronize

synchronize: boolean

Indicates if database schema should be auto created on every application launch. Be careful with this option and don't use this in production - otherwise you can lose production data. This option is useful during debug and development. Alternative to it, you can use CLI and run schema:sync command.

Note that for MongoDB database it does not create schema, because MongoDB is schemaless. Instead, it syncs just by creating indices.

type

type: "sqljs"

Database type.

Optional useLocalForage

useLocalForage: boolean

Enables the usage of the localforage library to save & load the database asynchronously from the indexedDB instead of using the synchron local storage methods in a browser environment.

Generated using TypeDoc