Skip to content

Instantly share code, notes, and snippets.

@diego3g
Created February 28, 2019 21:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diego3g/886169b9c9aee1443ed20632a08e4724 to your computer and use it in GitHub Desktop.
Save diego3g/886169b9c9aee1443ed20632a08e4724 to your computer and use it in GitHub Desktop.
interface Options {
/**
* The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql.
*
* Defaults to 'mysql'
*/
dialect?: string;
/**
* If specified, load the dialect library from this path. For example, if you want to use pg.js instead of
* pg when connecting to a pg database, you should specify 'pg.js' here
*/
dialectModulePath?: string;
/**
* An object of additional options, which are passed directly to the connection library
*/
dialectOptions?: Object;
/**
* Only used by sqlite.
*
* Defaults to ':memory:'
*/
storage?: string;
/**
* The host of the relational database.
*
* Defaults to 'localhost'
*/
host?: string;
/**
* The port of the relational database.
*/
port?: number;
/**
* The protocol of the relational database.
*
* Defaults to 'tcp'
*/
protocol?: string;
/**
* The username which is used to authenticate against the database.
*/
username?: string;
/**
* The password which is used to authenticate against the database.
*/
password?: string;
/**
* The name of the database
*/
database?: string;
/**
* Default options for model definitions. See sequelize.define for options
*/
define?: DefineOptions<any>;
/**
* Default options for sequelize.query
*/
query?: QueryOptions;
/**
* Default options for sequelize.set
*/
set?: SetOptions;
/**
* Default options for sequelize.sync
*/
sync?: SyncOptions;
/**
* The timezone used when converting a date from the database into a JavaScript date. The timezone is also
* used to SET TIMEZONE when connecting to the server, to ensure that the result of NOW, CURRENT_TIMESTAMP
* and other time related functions have in the right timezone. For best cross platform performance use the
* format
* +/-HH:MM. Will also accept string versions of timezones used by moment.js (e.g. 'America/Los_Angeles');
* this is useful to capture daylight savings time changes.
*
* Defaults to '+00:00'
*/
timezone?: string;
/**
* A function that gets executed everytime Sequelize would log something.
*
* Defaults to console.log
*/
logging?: boolean | Function;
/**
* A flag that defines if null values should be passed to SQL queries or not.
*
* Defaults to false
*/
omitNull?: boolean;
/**
* A flag that defines if native library shall be used or not. Currently only has an effect for postgres
*
* Defaults to false
*/
native?: boolean;
/**
* Use read / write replication. To enable replication, pass an object, with two properties, read and write.
* Write should be an object (a single server for handling writes), and read an array of object (several
* servers to handle reads). Each read/write server can have the following properties: `host`, `port`,
* `username`, `password`, `database`
*
* Defaults to false
*/
replication?: ReplicationOptions;
/**
* Set of flags that control when a query is automatically retried.
*/
retry?: RetryOptions;
/**
* Run built in type validators on insert and update,
* e.g. validate that arguments passed to integer fields are integer-like.
*
* Defaults to false
*/
typeValidation?: boolean;
/**
* Connection pool options
*/
pool?: PoolOptions;
/**
* Set to `false` to make table names and attributes case-insensitive on Postgres and skip double quoting of
* them.
*
* Defaults to true
*/
quoteIdentifiers?: boolean;
/**
* The version of the database. Most times, this is automatically detected and is not needed.
*
* Defaults to 0
*/
databaseVersion?: number;
/**
* Set the default transaction isolation level. See `Sequelize.Transaction.ISOLATION_LEVELS` for possible
* options.
*
* Defaults to 'REPEATABLE_READ'
*/
isolationLevel?: TransactionIsolationLevel;
/**
* Set the default transaction type. See `Sequelize.Transaction.TYPES` for possible
* options.
*
* Defaults to 'DEFERRED'
*/
transactionType?: TransactionType;
/**
* Print query execution time in milliseconds when logging SQL.
*
* Defaults to false
*/
benchmark?: boolean;
/**
* String based operator alias, default value is true which will enable all operators alias.
* Pass object to limit set of aliased operators or false to disable completely.
*/
operatorsAliases?: boolean | OperatorsAliases;
/**
* Set to `true` to enable connecting over SSL.
*
* Defaults to undefined
*/
ssl?: boolean;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment