• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

typeorm / typeorm / 22256862981

21 Feb 2026 12:31PM UTC coverage: 81.291% (+0.1%) from 81.176%
22256862981

push

github

web-flow
feat!: remove deprecated `Connection` and `ConnectionOptions` (#12022)

27682 of 33521 branches covered (82.58%)

Branch coverage included in aggregate %.

1205 of 1301 new or added lines in 76 files covered. (92.62%)

1 existing line in 1 file now uncovered.

93920 of 116068 relevant lines covered (80.92%)

71235.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/data-source/BaseDataSourceOptions.ts
1
import { EntitySchema } from "../entity-schema/EntitySchema"
×
2
import { LoggerOptions } from "../logger/LoggerOptions"
×
3
import { NamingStrategyInterface } from "../naming-strategy/NamingStrategyInterface"
×
4
import { DatabaseType } from "../driver/types/DatabaseType"
×
5
import { Logger } from "../logger/Logger"
×
6
import { DataSource } from "../data-source/DataSource"
×
7
import { QueryResultCache } from "../cache/QueryResultCache"
×
8
import { MixedList } from "../common/MixedList"
×
9

×
10
/**
×
11
 * BaseDataSourceOptions is set of DataSourceOptions shared by all database types.
×
12
 */
×
13
export interface BaseDataSourceOptions {
×
14
    /**
×
15
     * Database type. This value is required.
×
16
     */
×
17
    readonly type: DatabaseType
×
18

×
19
    /**
×
20
     * Connection name. If connection name is not given then it will be called "default".
×
21
     * Different connections must have different names.
×
22
     * @deprecated
×
23
     */
×
24
    readonly name?: string
×
25

×
26
    /**
×
27
     * Entities to be loaded for this connection.
×
28
     * Accepts both entity classes and directories where from entities need to be loaded.
×
29
     * Directories support glob patterns.
×
30
     */
×
31
    readonly entities?: MixedList<Function | string | EntitySchema>
×
32

×
33
    /**
×
34
     * Subscribers to be loaded for this connection.
×
35
     * Accepts both subscriber classes and directories where from subscribers need to be loaded.
×
36
     * Directories support glob patterns.
×
37
     */
×
38
    readonly subscribers?: MixedList<Function | string>
×
39

×
40
    /**
×
41
     * Migrations to be loaded for this connection.
×
42
     * Accepts both migration classes and glob patterns representing migration files.
×
43
     */
×
44
    readonly migrations?: MixedList<Function | string>
×
45

×
46
    /**
×
47
     * Migrations table name, in case of different name from "migrations".
×
48
     * Accepts single string name.
×
49
     */
×
50
    readonly migrationsTableName?: string
×
51

×
52
    /**
×
53
     * Transaction mode for migrations to run in
×
54
     */
×
55
    readonly migrationsTransactionMode?: "all" | "none" | "each"
×
56

×
57
    /**
×
58
     * Typeorm metadata table name, in case of different name from "typeorm_metadata".
×
59
     * Accepts single string name.
×
60
     */
×
61
    readonly metadataTableName?: string
×
62

×
63
    /**
×
64
     * Naming strategy to be used to name tables and columns in the database.
×
65
     */
×
66
    readonly namingStrategy?: NamingStrategyInterface
×
67

×
68
    /**
×
69
     * Logging options.
×
70
     */
×
71
    readonly logging?: LoggerOptions
×
72

×
73
    /**
×
74
     * Logger instance used to log queries and events in the ORM.
×
75
     */
×
76
    readonly logger?:
×
77
        | "advanced-console"
×
78
        | "simple-console"
×
79
        | "formatted-console"
×
80
        | "file"
×
81
        | "debug"
×
82
        | Logger
×
83

×
84
    /**
×
85
     * Maximum number of milliseconds query should be executed before logger log a warning.
×
86
     */
×
87
    readonly maxQueryExecutionTime?: number
×
88

×
89
    /**
×
90
     * Maximum number of clients the pool should contain.
×
91
     */
×
92
    readonly poolSize?: number
×
93

×
94
    /**
×
95
     * Indicates if database schema should be auto created on every application launch.
×
96
     * Be careful with this option and don't use this in production - otherwise you can lose production data.
×
97
     * This option is useful during debug and development.
×
98
     * Alternative to it, you can use CLI and run schema:sync command.
×
99
     *
×
100
     * Note that for MongoDB database it does not create schema, because MongoDB is schemaless.
×
101
     * Instead, it syncs just by creating indices.
×
102
     */
×
103
    readonly synchronize?: boolean
×
104

×
105
    /**
×
106
     * Indicates if migrations should be auto run on every application launch.
×
107
     * Alternative to it, you can use CLI and run migrations:run command.
×
108
     */
×
109
    readonly migrationsRun?: boolean
×
110

×
111
    /**
×
112
     * Drops the schema each time connection is being established.
×
113
     * Be careful with this option and don't use this in production - otherwise you'll lose all production data.
×
114
     * This option is useful during debug and development.
×
115
     */
×
116
    readonly dropSchema?: boolean
×
117

×
118
    /**
×
119
     * Prefix to use on all tables (collections) of this connection in the database.
×
120
     */
×
121
    readonly entityPrefix?: string
×
122

×
123
    /**
×
124
     * When creating new Entity instances, skip all constructors when true.
×
125
     */
×
126
    readonly entitySkipConstructor?: boolean
×
127

×
128
    /**
×
129
     * Extra connection options to be passed to the underlying driver.
×
130
     *
×
131
     * todo: deprecate this and move all database-specific types into hts own connection options object.
×
132
     */
×
133
    readonly extra?: any
×
134

×
135
    /**
×
136
     * Specifies how relations must be loaded - using "joins" or separate queries.
×
137
     * If you are loading too much data with nested joins it's better to load relations
×
138
     * using separate queries.
×
139
     *
×
140
     * Default strategy is "join", but this default can be changed here.
×
141
     * Also, strategy can be set per-query in FindOptions and QueryBuilder.
×
142
     */
×
143
    readonly relationLoadStrategy?: "join" | "query"
×
144

×
145
    /**
×
146
     * Optionally applied "typename" to the model.
×
147
     * If set, then each hydrated model will have this property with the target model / entity name inside.
×
148
     *
×
149
     * (works like a discriminator property).
×
150
     */
×
151
    readonly typename?: string
×
152

×
153
    /**
×
154
     * Holds reference to the baseDirectory where configuration file are expected.
×
155
     * @internal
×
156
     */
×
157
    baseDirectory?: string
×
158

×
159
    /**
×
160
     * Allows to setup cache options.
×
161
     */
×
162
    readonly cache?:
×
163
        | boolean
×
164
        | {
×
165
              /**
×
166
               * Type of caching.
×
167
               *
×
168
               * - "database" means cached values will be stored in the separate table in database. This is default value.
×
169
               * - "redis" means cached values will be stored inside redis. You must provide redis connection options.
×
170
               */
×
171
              readonly type?:
×
172
                  | "database"
×
173
                  | "redis"
×
174
                  | "ioredis"
×
175
                  | "ioredis/cluster" // todo: add mongodb and other cache providers as well in the future
×
176

×
177
              /**
×
178
               * Factory function for custom cache providers that implement QueryResultCache.
×
179
               */
×
NEW
180
              readonly provider?: (dataSource: DataSource) => QueryResultCache
×
181

×
182
              /**
×
183
               * Configurable table name for "database" type cache.
×
184
               * Default value is "query-result-cache"
×
185
               */
×
186
              readonly tableName?: string
×
187

×
188
              /**
×
189
               * Used to provide redis connection options.
×
190
               */
×
191
              readonly options?: any
×
192

×
193
              /**
×
194
               * If set to true then queries (using find methods and QueryBuilder's methods) will always be cached.
×
195
               */
×
196
              readonly alwaysEnabled?: boolean
×
197

×
198
              /**
×
199
               * Time in milliseconds in which cache will expire.
×
200
               * This can be setup per-query.
×
201
               * Default value is 1000 which is equivalent to 1 second.
×
202
               */
×
203
              readonly duration?: number
×
204

×
205
              /**
×
206
               * Used to specify if cache errors should be ignored, and pass through the call to the Database.
×
207
               */
×
208
              readonly ignoreErrors?: boolean
×
209
          }
×
210

×
211
    /**
×
212
     * Allows automatic isolation of where clauses
×
213
     */
×
214
    readonly isolateWhereStatements?: boolean
×
215

×
216
    /**
×
217
     * Controls how null and undefined values are handled in find operations.
×
218
     */
×
219
    readonly invalidWhereValuesBehavior?: {
×
220
        /**
×
221
         * How to handle null values in where conditions.
×
222
         * - 'ignore': Skip null properties (default)
×
223
         * - 'sql-null': Transform null to SQL NULL
×
224
         * - 'throw': Throw an error when null is encountered
×
225
         */
×
226
        readonly null?: "ignore" | "sql-null" | "throw"
×
227

×
228
        /**
×
229
         * How to handle undefined values in where conditions.
×
230
         * - 'ignore': Skip undefined properties (default)
×
231
         * - 'throw': Throw an error when undefined is encountered
×
232
         */
×
233
        readonly undefined?: "ignore" | "throw"
×
234
    }
×
235
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc