Skip to content

Commit 74e6cde

Browse files
committed
refactor: remove long deprecated things. (#1799)
1 parent 89d927b commit 74e6cde

18 files changed

Lines changed: 21 additions & 185 deletions

src/dialect/database-introspector.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ export interface DatabaseIntrospector {
1111
* Get tables and views metadata.
1212
*/
1313
getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>
14-
15-
/**
16-
* Get the database metadata such as table and column names.
17-
*
18-
* @deprecated Use getTables() instead.
19-
*/
20-
getMetadata(options?: DatabaseMetadataOptions): Promise<DatabaseMetadata>
2114
}
2215

2316
export interface DatabaseMetadataOptions {
@@ -32,14 +25,6 @@ export interface SchemaMetadata {
3225
readonly name: string
3326
}
3427

35-
export interface DatabaseMetadata {
36-
/**
37-
* The tables and views found in the database.
38-
* The propery isView can be used to tell them apart.
39-
*/
40-
readonly tables: TableMetadata[]
41-
}
42-
4328
export interface TableMetadata {
4429
readonly name: string
4530
readonly isView: boolean

src/dialect/mssql/mssql-dialect-config.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { KyselyTypeError } from '../../util/type-error.js'
2-
31
export interface MssqlDialectConfig {
42
/**
53
* When `true`, connections are reset to their initial states when released
@@ -79,11 +77,6 @@ export interface Tedious {
7977
connectionFactory: () => TediousConnection | Promise<TediousConnection>
8078
ISOLATION_LEVEL: TediousIsolationLevel
8179
Request: TediousRequestClass
82-
// TODO: remove in v0.29.0
83-
/**
84-
* @deprecated use {@link MssqlDialectConfig.resetConnectionsOnRelease} instead.
85-
*/
86-
resetConnectionOnRelease?: KyselyTypeError<'deprecated: use `MssqlDialectConfig.resetConnectionsOnRelease` instead'>
8780
TYPES: TediousTypes
8881
}
8982

@@ -180,13 +173,7 @@ export interface Tarn {
180173
* Tarn.js' pool options, excluding `create`, `destroy` and `validate` functions,
181174
* which must be implemented by this dialect.
182175
*/
183-
options: Omit<TarnPoolOptions<any>, 'create' | 'destroy' | 'validate'> & {
184-
// TODO: remove in v0.29.0
185-
/**
186-
* @deprecated use {@link MssqlDialectConfig.validateConnections} instead.
187-
*/
188-
validateConnections?: KyselyTypeError<'deprecated: use `MssqlDialectConfig.validateConnections` instead'>
189-
}
176+
options: Omit<TarnPoolOptions<any>, 'create' | 'destroy' | 'validate'>
190177

191178
/**
192179
* Tarn.js' Pool class.

src/dialect/mssql/mssql-driver.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,9 @@ export class MssqlDriver implements Driver {
4343
this.#config = freeze({ ...config })
4444

4545
const { tarn, tedious, validateConnections } = this.#config
46-
const {
47-
validateConnections: deprecatedValidateConnections,
48-
...poolOptions
49-
} = tarn.options
5046

5147
this.#pool = new tarn.Pool({
52-
...poolOptions,
48+
...tarn.options,
5349
create: async () => {
5450
const connection = await tedious.connectionFactory()
5551

@@ -61,8 +57,7 @@ export class MssqlDriver implements Driver {
6157
// @ts-ignore `tarn` accepts a function that returns a promise here, but
6258
// the types are not aligned and it type errors.
6359
validate:
64-
validateConnections === false ||
65-
(deprecatedValidateConnections as any) === false
60+
validateConnections === false
6661
? undefined
6762
: (connection) => connection[PRIVATE_VALIDATE_METHOD](),
6863
})
@@ -106,10 +101,7 @@ export class MssqlDriver implements Driver {
106101
}
107102

108103
async releaseConnection(connection: MssqlConnection): Promise<void> {
109-
if (
110-
this.#config.resetConnectionsOnRelease ||
111-
this.#config.tedious.resetConnectionOnRelease
112-
) {
104+
if (this.#config.resetConnectionsOnRelease) {
113105
await connection[PRIVATE_RESET_METHOD]()
114106
}
115107

@@ -126,7 +118,6 @@ class MssqlConnection implements DatabaseConnection {
126118
#hasSocketError: boolean
127119
readonly #tedious: Tedious
128120
#inflightRequest: MssqlRequest<any> | undefined
129-
#sessionId: unknown
130121

131122
constructor(connection: TediousConnection, tedious: Tedious) {
132123
this.#connection = connection

src/dialect/mssql/mssql-introspector.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import type { Kysely } from '../../kysely.js'
22
import type {
33
DatabaseIntrospector,
4-
DatabaseMetadata,
54
DatabaseMetadataOptions,
65
SchemaMetadata,
76
TableMetadata,
@@ -169,14 +168,6 @@ export class MssqlIntrospector implements DatabaseIntrospector {
169168

170169
return Object.values(tableDictionary)
171170
}
172-
173-
async getMetadata(
174-
options?: DatabaseMetadataOptions,
175-
): Promise<DatabaseMetadata> {
176-
return {
177-
tables: await this.getTables(options),
178-
}
179-
}
180171
}
181172

182173
interface MssqlSysTables {

src/dialect/mysql/mysql-introspector.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type {
22
DatabaseIntrospector,
3-
DatabaseMetadata,
43
DatabaseMetadataOptions,
54
SchemaMetadata,
65
TableMetadata,
@@ -68,14 +67,6 @@ export class MysqlIntrospector implements DatabaseIntrospector {
6867
return this.#parseTableMetadata(rawColumns)
6968
}
7069

71-
async getMetadata(
72-
options?: DatabaseMetadataOptions,
73-
): Promise<DatabaseMetadata> {
74-
return {
75-
tables: await this.getTables(options),
76-
}
77-
}
78-
7970
#parseTableMetadata(columns: RawColumnMetadata[]): TableMetadata[] {
8071
return columns.reduce<TableMetadata[]>((tables, it) => {
8172
let table = tables.find((tbl) => tbl.name === it.TABLE_NAME)

src/dialect/postgres/postgres-driver.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import type { Driver, TransactionSettings } from '../../driver/driver.js'
77
import { parseSavepointCommand } from '../../parser/savepoint-parser.js'
88
import { CompiledQuery } from '../../query-compiler/compiled-query.js'
99
import type { QueryCompiler } from '../../query-compiler/query-compiler.js'
10-
import type {
11-
AbortableOperationOptions,
12-
AbortableQueryOptions,
13-
} from '../../util/abort.js'
10+
import type { AbortableOperationOptions } from '../../util/abort.js'
1411
import { isFunction, freeze } from '../../util/object-utils.js'
1512
import { createQueryId, type QueryId } from '../../util/query-id.js'
1613
import { extendStackTrace } from '../../util/stack-trace-utils.js'

src/dialect/postgres/postgres-introspector.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type {
22
DatabaseIntrospector,
3-
DatabaseMetadata,
43
DatabaseMetadataOptions,
54
SchemaMetadata,
65
TableMetadata,
@@ -97,14 +96,6 @@ export class PostgresIntrospector implements DatabaseIntrospector {
9796
return this.#parseTableMetadata(rawColumns)
9897
}
9998

100-
async getMetadata(
101-
options?: DatabaseMetadataOptions,
102-
): Promise<DatabaseMetadata> {
103-
return {
104-
tables: await this.getTables(options),
105-
}
106-
}
107-
10899
#parseTableMetadata(columns: RawColumnMetadata[]): TableMetadata[] {
109100
const tableDictionary: Map<string, TableMetadata> = new Map()
110101

src/dialect/sqlite/sqlite-introspector.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type {
22
DatabaseIntrospector,
3-
DatabaseMetadata,
43
DatabaseMetadataOptions,
54
SchemaMetadata,
65
TableMetadata,
@@ -55,14 +54,6 @@ export class SqliteIntrospector implements DatabaseIntrospector {
5554
return await this.#getTableMetadata(options)
5655
}
5756

58-
async getMetadata(
59-
options?: DatabaseMetadataOptions,
60-
): Promise<DatabaseMetadata> {
61-
return {
62-
tables: await this.getTables(options),
63-
}
64-
}
65-
6657
#tablesQuery(
6758
qb: QueryCreator<SqliteSystemDatabase> | Kysely<SqliteSystemDatabase>,
6859
options: DatabaseMetadataOptions,

src/expression/expression-builder.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
type TableExpressionOrList,
99
parseTable,
1010
} from '../parser/table-parser.js'
11-
import { WithSchemaPlugin } from '../plugin/with-schema/with-schema-plugin.js'
1211
import { createQueryId } from '../util/query-id.js'
1312
import {
1413
createFunctionModule,
@@ -1144,13 +1143,6 @@ export interface ExpressionBuilder<DB, TB extends keyof DB> {
11441143
expr: RE,
11451144
dataType: DataTypeExpression,
11461145
): ExpressionWrapper<DB, TB, T>
1147-
1148-
/**
1149-
* See {@link QueryCreator.withSchema}
1150-
*
1151-
* @deprecated Will be removed in kysely 0.25.0.
1152-
*/
1153-
withSchema(schema: string): ExpressionBuilder<DB, TB>
11541146
}
11551147

11561148
export function createExpressionBuilder<DB, TB extends keyof DB>(
@@ -1369,12 +1361,6 @@ export function createExpressionBuilder<DB, TB extends keyof DB>(
13691361
),
13701362
)
13711363
},
1372-
1373-
withSchema(schema: string): ExpressionBuilder<DB, TB> {
1374-
return createExpressionBuilder(
1375-
executor.withPluginAtFront(new WithSchemaPlugin(schema)),
1376-
)
1377-
},
13781364
})
13791365

13801366
eb.fn = createFunctionModule()

src/operation-node/drop-table-node.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ import { freeze } from '../util/object-utils.js'
22
import type { OperationNode } from './operation-node.js'
33
import type { TableNode } from './table-node.js'
44

5-
export type DropTablexNodeParams = Omit<
6-
Partial<DropTableNode>,
7-
'kind' | 'table'
8-
>
5+
export type DropTableNodeParams = Omit<Partial<DropTableNode>, 'kind' | 'table'>
6+
7+
// TODO: remove in 0.30
8+
/**
9+
* @deprecated use {@link DropTableNodeParams} instead.
10+
*/
11+
export type DropTablexNodeParams = DropTableNodeParams
12+
913
export interface DropTableNode extends OperationNode {
1014
readonly kind: 'DropTableNode'
1115
readonly table: TableNode
@@ -18,11 +22,11 @@ type DropTableNodeFactory = Readonly<{
1822
is(node: OperationNode): node is DropTableNode
1923
create(
2024
table: TableNode,
21-
params?: DropTablexNodeParams,
25+
params?: DropTableNodeParams,
2226
): Readonly<DropTableNode>
2327
cloneWith(
2428
dropIndex: DropTableNode,
25-
params: DropTablexNodeParams,
29+
params: DropTableNodeParams,
2630
): Readonly<DropTableNode>
2731
}>
2832

0 commit comments

Comments
 (0)