Skip to content

Commit 97f1b1b

Browse files
committed
Add ISequelizeStorageConfig to allow configuration of SQLite only via the dialect
':memory:' will be used as storage by default, but this can be changed
1 parent 703cb87 commit 97f1b1b

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import {Options} from 'sequelize';
2+
import {ModelMatch} from '../types/SequelizeConfig';
3+
4+
/**
5+
* Configuration for using SQLite only with the dialect option
6+
*/
7+
export interface ISequelizeStorageConfig extends Options {
8+
/**
9+
* The dialect of the database you are connecting to. One of mysql, postgres, sqlite, mariadb and mssql.
10+
*
11+
* If 'sqlite' is used, only passing the dialect is valid (':memory:' will be used for storage, but this can be changed)
12+
*/
13+
dialect: 'sqlite';
14+
15+
/**
16+
* Path to models, which should be loaded
17+
*/
18+
modelPaths?: string[];
19+
20+
/**
21+
* Matches models by filename using a custom function.
22+
* @default (filename, member) => filename === member
23+
*/
24+
modelMatch?: ModelMatch;
25+
26+
/**
27+
* Makes it possible to use sequelize for validation only
28+
* if set to true. For this configuration it is always false.
29+
* See ISequelizeValidationOnlyConfig interface
30+
*/
31+
validateOnly?: false;
32+
}

lib/types/SequelizeConfig.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {ISequelizeConfig} from "../interfaces/ISequelizeConfig";
22
import {ISequelizeUriConfig} from "../interfaces/ISequelizeUriConfig";
33
import {ISequelizeDbNameConfig} from "../interfaces/ISequelizeDbNameConfig";
4+
import {ISequelizeStorageConfig} from "../interfaces/ISequelizeStorageConfig";
45

5-
export type SequelizeConfig = ISequelizeConfig | ISequelizeUriConfig | ISequelizeDbNameConfig;
6+
export type SequelizeConfig = ISequelizeConfig | ISequelizeUriConfig | ISequelizeDbNameConfig | ISequelizeStorageConfig;
67

78
export type ModelMatch = (filename: string, member: string) => boolean;

0 commit comments

Comments
 (0)