kysely 0.17.3 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -17
- package/dist/cjs/dialect/database-introspector.d.ts +13 -0
- package/dist/cjs/dialect/mysql/mysql-dialect-config.d.ts +24 -207
- package/dist/cjs/dialect/mysql/mysql-dialect.d.ts +26 -3
- package/dist/cjs/dialect/mysql/mysql-dialect.js +27 -5
- package/dist/cjs/dialect/mysql/mysql-driver.d.ts +13 -4
- package/dist/cjs/dialect/mysql/mysql-driver.js +33 -51
- package/dist/cjs/dialect/mysql/mysql-introspector.d.ts +11 -1
- package/dist/cjs/dialect/mysql/mysql-introspector.js +29 -7
- package/dist/cjs/dialect/postgres/postgres-dialect-config.d.ts +25 -89
- package/dist/cjs/dialect/postgres/postgres-dialect.d.ts +25 -5
- package/dist/cjs/dialect/postgres/postgres-dialect.js +26 -7
- package/dist/cjs/dialect/postgres/postgres-driver.d.ts +12 -3
- package/dist/cjs/dialect/postgres/postgres-driver.js +21 -39
- package/dist/cjs/dialect/postgres/postgres-introspector.d.ts +11 -1
- package/dist/cjs/dialect/postgres/postgres-introspector.js +15 -4
- package/dist/cjs/dialect/sqlite/sqlite-dialect-config.d.ts +25 -28
- package/dist/cjs/dialect/sqlite/sqlite-dialect.d.ts +19 -3
- package/dist/cjs/dialect/sqlite/sqlite-dialect.js +19 -3
- package/dist/cjs/dialect/sqlite/sqlite-driver.js +3 -37
- package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +11 -1
- package/dist/cjs/dialect/sqlite/sqlite-introspector.js +11 -4
- package/dist/cjs/index.d.ts +153 -2
- package/dist/cjs/index.js +147 -3
- package/dist/cjs/migration/file-migration-provider.d.ts +21 -5
- package/dist/cjs/migration/file-migration-provider.js +14 -13
- package/dist/cjs/migration/migrator.d.ts +44 -2
- package/dist/cjs/migration/migrator.js +77 -18
- package/dist/cjs/operation-node/alias-node.d.ts +2 -2
- package/dist/cjs/operation-node/alias-node.js +1 -2
- package/dist/cjs/operation-node/operation-node-transformer.js +1 -0
- package/dist/cjs/operation-node/update-query-node.d.ts +3 -0
- package/dist/cjs/operation-node/update-query-node.js +11 -2
- package/dist/cjs/parser/reference-parser.js +2 -1
- package/dist/cjs/parser/table-parser.js +2 -1
- package/dist/cjs/parser/update-set-parser.d.ts +3 -3
- package/dist/cjs/parser/with-parser.d.ts +2 -2
- package/dist/cjs/plugin/noop-plugin.d.ts +42 -0
- package/dist/cjs/plugin/noop-plugin.js +12 -0
- package/dist/cjs/query-builder/insert-query-builder.d.ts +1 -1
- package/dist/cjs/query-builder/on-conflict-builder.d.ts +1 -1
- package/dist/cjs/query-builder/select-query-builder.d.ts +3 -1
- package/dist/cjs/query-builder/select-query-builder.js +5 -5
- package/dist/cjs/query-builder/update-query-builder.d.ts +57 -28
- package/dist/cjs/query-builder/update-query-builder.js +7 -0
- package/dist/cjs/query-compiler/default-query-compiler.js +4 -0
- package/dist/cjs/query-creator.d.ts +10 -1
- package/dist/cjs/query-creator.js +18 -0
- package/dist/cjs/raw-builder/raw-builder.d.ts +32 -2
- package/dist/cjs/raw-builder/raw-builder.js +5 -26
- package/dist/cjs/schema/schema.d.ts +9 -0
- package/dist/cjs/schema/schema.js +12 -0
- package/dist/cjs/util/column-type.d.ts +9 -1
- package/dist/cjs/util/stack-trace-utils.d.ts +1 -0
- package/dist/cjs/util/stack-trace-utils.js +17 -0
- package/dist/esm/dialect/database-introspector.d.ts +13 -0
- package/dist/esm/dialect/mysql/mysql-dialect-config.d.ts +24 -207
- package/dist/esm/dialect/mysql/mysql-dialect.d.ts +26 -3
- package/dist/esm/dialect/mysql/mysql-dialect.js +27 -5
- package/dist/esm/dialect/mysql/mysql-driver.d.ts +13 -4
- package/dist/esm/dialect/mysql/mysql-driver.js +33 -51
- package/dist/esm/dialect/mysql/mysql-introspector.d.ts +11 -1
- package/dist/esm/dialect/mysql/mysql-introspector.js +30 -8
- package/dist/esm/dialect/postgres/postgres-dialect-config.d.ts +25 -89
- package/dist/esm/dialect/postgres/postgres-dialect.d.ts +25 -5
- package/dist/esm/dialect/postgres/postgres-dialect.js +26 -7
- package/dist/esm/dialect/postgres/postgres-driver.d.ts +12 -3
- package/dist/esm/dialect/postgres/postgres-driver.js +21 -39
- package/dist/esm/dialect/postgres/postgres-introspector.d.ts +11 -1
- package/dist/esm/dialect/postgres/postgres-introspector.js +16 -5
- package/dist/esm/dialect/sqlite/sqlite-dialect-config.d.ts +25 -28
- package/dist/esm/dialect/sqlite/sqlite-dialect.d.ts +19 -3
- package/dist/esm/dialect/sqlite/sqlite-dialect.js +19 -3
- package/dist/esm/dialect/sqlite/sqlite-driver.js +4 -38
- package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +11 -1
- package/dist/esm/dialect/sqlite/sqlite-introspector.js +12 -5
- package/dist/esm/index.d.ts +153 -2
- package/dist/esm/index.js +142 -2
- package/dist/esm/migration/file-migration-provider.d.ts +21 -5
- package/dist/esm/migration/file-migration-provider.js +14 -13
- package/dist/esm/migration/migrator.d.ts +44 -2
- package/dist/esm/migration/migrator.js +76 -17
- package/dist/esm/operation-node/alias-node.d.ts +2 -2
- package/dist/esm/operation-node/alias-node.js +1 -2
- package/dist/esm/operation-node/operation-node-transformer.js +1 -0
- package/dist/esm/operation-node/update-query-node.d.ts +3 -0
- package/dist/esm/operation-node/update-query-node.js +11 -2
- package/dist/esm/parser/reference-parser.js +2 -1
- package/dist/esm/parser/table-parser.js +2 -1
- package/dist/esm/parser/update-set-parser.d.ts +3 -3
- package/dist/esm/parser/with-parser.d.ts +2 -2
- package/dist/esm/plugin/noop-plugin.d.ts +42 -0
- package/dist/esm/plugin/noop-plugin.js +9 -0
- package/dist/esm/query-builder/insert-query-builder.d.ts +1 -1
- package/dist/esm/query-builder/on-conflict-builder.d.ts +1 -1
- package/dist/esm/query-builder/select-query-builder.d.ts +3 -1
- package/dist/esm/query-builder/select-query-builder.js +5 -5
- package/dist/esm/query-builder/update-query-builder.d.ts +57 -28
- package/dist/esm/query-builder/update-query-builder.js +7 -0
- package/dist/esm/query-compiler/default-query-compiler.js +4 -0
- package/dist/esm/query-creator.d.ts +10 -1
- package/dist/esm/query-creator.js +18 -0
- package/dist/esm/raw-builder/raw-builder.d.ts +32 -2
- package/dist/esm/raw-builder/raw-builder.js +5 -26
- package/dist/esm/schema/schema.d.ts +9 -0
- package/dist/esm/schema/schema.js +12 -0
- package/dist/esm/util/column-type.d.ts +9 -1
- package/dist/esm/util/stack-trace-utils.d.ts +1 -0
- package/dist/esm/util/stack-trace-utils.js +14 -0
- package/package.json +10 -15
- package/dist/cjs/index-nodeless.d.ts +0 -152
- package/dist/cjs/index-nodeless.js +0 -153
- package/dist/esm/index-nodeless.d.ts +0 -152
- package/dist/esm/index-nodeless.js +0 -142
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import { DatabaseIntrospector, DatabaseMetadata, DatabaseMetadataOptions } from '../database-introspector.js';
|
|
1
|
+
import { DatabaseIntrospector, DatabaseMetadata, DatabaseMetadataOptions, SchemaMetadata, TableMetadata } from '../database-introspector.js';
|
|
2
2
|
import { Kysely } from '../../kysely.js';
|
|
3
3
|
export declare class SqliteIntrospector implements DatabaseIntrospector {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(db: Kysely<any>);
|
|
6
|
+
/**
|
|
7
|
+
* Get schema metadata.
|
|
8
|
+
*/
|
|
9
|
+
getSchemas(): Promise<SchemaMetadata[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Get table metadata.
|
|
12
|
+
*/
|
|
13
|
+
getTables(options?: DatabaseMetadataOptions): Promise<TableMetadata[]>;
|
|
6
14
|
/**
|
|
7
15
|
* Get the database metadata such as table and column names.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated Use getTables() instead.
|
|
8
18
|
*/
|
|
9
19
|
getMetadata(options?: DatabaseMetadataOptions): Promise<DatabaseMetadata>;
|
|
10
20
|
}
|
|
@@ -8,7 +8,11 @@ class SqliteIntrospector {
|
|
|
8
8
|
constructor(db) {
|
|
9
9
|
this.#db = db;
|
|
10
10
|
}
|
|
11
|
-
async
|
|
11
|
+
async getSchemas() {
|
|
12
|
+
// Sqlite doesn't support schemas.
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
async getTables(options = { withInternalKyselyTables: false }) {
|
|
12
16
|
let query = this.#db
|
|
13
17
|
.selectFrom('sqlite_schema')
|
|
14
18
|
.where('type', '=', 'table')
|
|
@@ -17,12 +21,15 @@ class SqliteIntrospector {
|
|
|
17
21
|
.castTo();
|
|
18
22
|
if (!options.withInternalKyselyTables) {
|
|
19
23
|
query = query
|
|
20
|
-
.where('name', '!=', migrator_js_1.
|
|
21
|
-
.where('name', '!=', migrator_js_1.
|
|
24
|
+
.where('name', '!=', migrator_js_1.DEFAULT_MIGRATION_TABLE)
|
|
25
|
+
.where('name', '!=', migrator_js_1.DEFAULT_MIGRATION_LOCK_TABLE);
|
|
22
26
|
}
|
|
23
27
|
const tables = await query.execute();
|
|
28
|
+
return Promise.all(tables.map(({ name }) => this.#getTableMetadata(name)));
|
|
29
|
+
}
|
|
30
|
+
async getMetadata(options) {
|
|
24
31
|
return {
|
|
25
|
-
tables: await
|
|
32
|
+
tables: await this.getTables(options),
|
|
26
33
|
};
|
|
27
34
|
}
|
|
28
35
|
async #getTableMetadata(table) {
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,11 +1,162 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './kysely.js';
|
|
2
|
+
export * from './query-creator.js';
|
|
3
|
+
export * from './query-builder/where-interface.js';
|
|
4
|
+
export * from './query-builder/join-interface.js';
|
|
5
|
+
export * from './query-builder/returning-interface.js';
|
|
6
|
+
export * from './query-builder/having-interface.js';
|
|
7
|
+
export * from './query-builder/select-query-builder.js';
|
|
8
|
+
export * from './query-builder/insert-query-builder.js';
|
|
9
|
+
export * from './query-builder/update-query-builder.js';
|
|
10
|
+
export * from './query-builder/delete-query-builder.js';
|
|
11
|
+
export * from './query-builder/no-result-error.js';
|
|
12
|
+
export * from './query-builder/join-builder.js';
|
|
13
|
+
export * from './query-builder/expression-builder.js';
|
|
14
|
+
export * from './query-builder/function-builder.js';
|
|
15
|
+
export * from './query-builder/insert-result.js';
|
|
16
|
+
export * from './query-builder/delete-result.js';
|
|
17
|
+
export * from './query-builder/update-result.js';
|
|
18
|
+
export * from './query-builder/on-conflict-builder.js';
|
|
19
|
+
export * from './raw-builder/raw-builder.js';
|
|
20
|
+
export * from './raw-builder/sql.js';
|
|
21
|
+
export * from './query-executor/query-executor.js';
|
|
22
|
+
export * from './query-executor/default-query-executor.js';
|
|
23
|
+
export * from './query-executor/noop-query-executor.js';
|
|
24
|
+
export * from './query-executor/query-executor-provider.js';
|
|
25
|
+
export * from './query-compiler/default-query-compiler.js';
|
|
26
|
+
export * from './query-compiler/compiled-query.js';
|
|
27
|
+
export * from './schema/schema.js';
|
|
28
|
+
export * from './schema/create-table-builder.js';
|
|
29
|
+
export * from './schema/drop-table-builder.js';
|
|
30
|
+
export * from './schema/create-index-builder.js';
|
|
31
|
+
export * from './schema/drop-index-builder.js';
|
|
32
|
+
export * from './schema/create-schema-builder.js';
|
|
33
|
+
export * from './schema/drop-schema-builder.js';
|
|
34
|
+
export * from './schema/column-definition-builder.js';
|
|
35
|
+
export * from './schema/foreign-key-constraint-builder.js';
|
|
36
|
+
export * from './schema/alter-table-builder.js';
|
|
37
|
+
export * from './schema/create-view-builder.js';
|
|
38
|
+
export * from './schema/drop-view-builder.js';
|
|
39
|
+
export * from './dynamic/dynamic.js';
|
|
40
|
+
export * from './driver/driver.js';
|
|
41
|
+
export * from './driver/database-connection.js';
|
|
42
|
+
export * from './driver/connection-provider.js';
|
|
43
|
+
export * from './driver/default-connection-provider.js';
|
|
44
|
+
export * from './driver/single-connection-provider.js';
|
|
45
|
+
export * from './driver/dummy-driver.js';
|
|
46
|
+
export * from './dialect/dialect.js';
|
|
47
|
+
export * from './dialect/dialect-adapter.js';
|
|
48
|
+
export * from './dialect/dialect-adapter-base.js';
|
|
49
|
+
export * from './dialect/database-introspector.js';
|
|
3
50
|
export * from './dialect/sqlite/sqlite-dialect.js';
|
|
4
51
|
export * from './dialect/sqlite/sqlite-dialect-config.js';
|
|
5
52
|
export * from './dialect/sqlite/sqlite-driver.js';
|
|
53
|
+
export * from './dialect/postgres/postgres-query-compiler.js';
|
|
54
|
+
export * from './dialect/postgres/postgres-introspector.js';
|
|
55
|
+
export * from './dialect/postgres/postgres-adapter.js';
|
|
6
56
|
export * from './dialect/mysql/mysql-dialect.js';
|
|
7
57
|
export * from './dialect/mysql/mysql-dialect-config.js';
|
|
8
58
|
export * from './dialect/mysql/mysql-driver.js';
|
|
59
|
+
export * from './dialect/mysql/mysql-query-compiler.js';
|
|
60
|
+
export * from './dialect/mysql/mysql-introspector.js';
|
|
61
|
+
export * from './dialect/mysql/mysql-adapter.js';
|
|
9
62
|
export * from './dialect/postgres/postgres-driver.js';
|
|
10
63
|
export * from './dialect/postgres/postgres-dialect-config.js';
|
|
11
64
|
export * from './dialect/postgres/postgres-dialect.js';
|
|
65
|
+
export * from './dialect/sqlite/sqlite-query-compiler.js';
|
|
66
|
+
export * from './dialect/sqlite/sqlite-introspector.js';
|
|
67
|
+
export * from './dialect/sqlite/sqlite-adapter.js';
|
|
68
|
+
export * from './query-compiler/default-query-compiler.js';
|
|
69
|
+
export * from './query-compiler/query-compiler.js';
|
|
70
|
+
export * from './migration/migrator.js';
|
|
71
|
+
export * from './migration/file-migration-provider.js';
|
|
72
|
+
export * from './plugin/kysely-plugin.js';
|
|
73
|
+
export * from './plugin/camel-case/camel-case-plugin.js';
|
|
74
|
+
export * from './plugin/deduplicate-joins/deduplicate-joins-plugin.js';
|
|
75
|
+
export * from './operation-node/add-column-node.js';
|
|
76
|
+
export * from './operation-node/add-constraint-node.js';
|
|
77
|
+
export * from './operation-node/alias-node.js';
|
|
78
|
+
export * from './operation-node/alter-column-node.js';
|
|
79
|
+
export * from './operation-node/alter-table-node.js';
|
|
80
|
+
export * from './operation-node/and-node.js';
|
|
81
|
+
export * from './operation-node/check-constraint-node.js';
|
|
82
|
+
export * from './operation-node/column-definition-node.js';
|
|
83
|
+
export * from './operation-node/column-node.js';
|
|
84
|
+
export * from './operation-node/column-update-node.js';
|
|
85
|
+
export * from './operation-node/common-table-expression-node.js';
|
|
86
|
+
export * from './operation-node/common-table-expression-name-node.js';
|
|
87
|
+
export * from './operation-node/constraint-node.js';
|
|
88
|
+
export * from './operation-node/create-index-node.js';
|
|
89
|
+
export * from './operation-node/create-schema-node.js';
|
|
90
|
+
export * from './operation-node/create-table-node.js';
|
|
91
|
+
export * from './operation-node/create-view-node.js';
|
|
92
|
+
export * from './operation-node/data-type-node.js';
|
|
93
|
+
export * from './operation-node/default-value-node.js';
|
|
94
|
+
export * from './operation-node/delete-query-node.js';
|
|
95
|
+
export * from './operation-node/drop-column-node.js';
|
|
96
|
+
export * from './operation-node/drop-constraint-node.js';
|
|
97
|
+
export * from './operation-node/drop-index-node.js';
|
|
98
|
+
export * from './operation-node/drop-schema-node.js';
|
|
99
|
+
export * from './operation-node/drop-table-node.js';
|
|
100
|
+
export * from './operation-node/drop-view-node.js';
|
|
101
|
+
export * from './operation-node/filter-node.js';
|
|
102
|
+
export * from './operation-node/foreign-key-constraint-node.js';
|
|
103
|
+
export * from './operation-node/from-node.js';
|
|
104
|
+
export * from './operation-node/generated-node.js';
|
|
105
|
+
export * from './operation-node/group-by-item-node.js';
|
|
106
|
+
export * from './operation-node/group-by-node.js';
|
|
107
|
+
export * from './operation-node/having-node.js';
|
|
108
|
+
export * from './operation-node/identifier-node.js';
|
|
109
|
+
export * from './operation-node/insert-query-node.js';
|
|
110
|
+
export * from './operation-node/join-node.js';
|
|
111
|
+
export * from './operation-node/limit-node.js';
|
|
112
|
+
export * from './operation-node/list-node.js';
|
|
113
|
+
export * from './operation-node/modify-column-node.js';
|
|
114
|
+
export * from './operation-node/offset-node.js';
|
|
115
|
+
export * from './operation-node/on-conflict-node.js';
|
|
116
|
+
export * from './operation-node/on-duplicate-key-node.js';
|
|
117
|
+
export * from './operation-node/on-node.js';
|
|
118
|
+
export * from './operation-node/operation-node-source.js';
|
|
119
|
+
export * from './operation-node/operation-node-transformer.js';
|
|
120
|
+
export * from './operation-node/operation-node-utils.js';
|
|
121
|
+
export * from './operation-node/operation-node-visitor.js';
|
|
122
|
+
export * from './operation-node/operation-node.js';
|
|
123
|
+
export * from './operation-node/operator-node.js';
|
|
124
|
+
export * from './operation-node/or-node.js';
|
|
125
|
+
export * from './operation-node/order-by-item-node.js';
|
|
126
|
+
export * from './operation-node/order-by-node.js';
|
|
127
|
+
export * from './operation-node/parens-node.js';
|
|
128
|
+
export * from './operation-node/primary-constraint-node.js';
|
|
129
|
+
export * from './operation-node/primitive-value-list-node.js';
|
|
130
|
+
export * from './operation-node/query-node.js';
|
|
131
|
+
export * from './operation-node/raw-node.js';
|
|
132
|
+
export * from './operation-node/reference-node.js';
|
|
133
|
+
export * from './operation-node/references-node.js';
|
|
134
|
+
export * from './operation-node/rename-column-node.js';
|
|
135
|
+
export * from './operation-node/returning-node.js';
|
|
136
|
+
export * from './operation-node/select-all-node.js';
|
|
137
|
+
export * from './operation-node/select-query-node.js';
|
|
138
|
+
export * from './operation-node/select-query-node.js';
|
|
139
|
+
export * from './operation-node/selection-node.js';
|
|
140
|
+
export * from './operation-node/table-node.js';
|
|
141
|
+
export * from './operation-node/union-node.js';
|
|
142
|
+
export * from './operation-node/unique-constraint-node.js';
|
|
143
|
+
export * from './operation-node/update-query-node.js';
|
|
144
|
+
export * from './operation-node/value-list-node.js';
|
|
145
|
+
export * from './operation-node/value-node.js';
|
|
146
|
+
export * from './operation-node/values-node.js';
|
|
147
|
+
export * from './operation-node/where-node.js';
|
|
148
|
+
export * from './operation-node/with-node.js';
|
|
149
|
+
export * from './util/column-type.js';
|
|
150
|
+
export * from './util/compilable.js';
|
|
151
|
+
export * from './util/log.js';
|
|
152
|
+
export { AnyColumn, UnknownRow, AnySelectQueryBuilder, } from './util/type-utils.js';
|
|
153
|
+
export { SelectExpression, SelectExpressionOrList, Selection, } from './parser/select-parser.js';
|
|
154
|
+
export { ReferenceExpression, ReferenceExpressionOrList, } from './parser/reference-parser.js';
|
|
155
|
+
export { ValueExpression, ValueExpressionOrList, } from './parser/value-parser.js';
|
|
156
|
+
export { FilterValueExpression, FilterValueExpressionOrList, ExistsExpression, FilterOperator, } from './parser/filter-parser.js';
|
|
157
|
+
export { TableExpression, TableExpressionOrList, } from './parser/table-parser.js';
|
|
158
|
+
export { JoinReferenceExpression, JoinCallbackExpression, } from './parser/join-parser.js';
|
|
159
|
+
export { InsertObject } from './parser/insert-values-parser.js';
|
|
160
|
+
export { MutationObject } from './parser/update-set-parser.js';
|
|
161
|
+
export { OrderByExpression, OrderByDirectionExpression, } from './parser/order-by-parser.js';
|
|
162
|
+
export { UnionExpression } from './parser/union-parser.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -10,14 +14,154 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
15
|
};
|
|
12
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./
|
|
14
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./kysely.js"), exports);
|
|
18
|
+
__exportStar(require("./query-creator.js"), exports);
|
|
19
|
+
__exportStar(require("./query-builder/where-interface.js"), exports);
|
|
20
|
+
__exportStar(require("./query-builder/join-interface.js"), exports);
|
|
21
|
+
__exportStar(require("./query-builder/returning-interface.js"), exports);
|
|
22
|
+
__exportStar(require("./query-builder/having-interface.js"), exports);
|
|
23
|
+
__exportStar(require("./query-builder/select-query-builder.js"), exports);
|
|
24
|
+
__exportStar(require("./query-builder/insert-query-builder.js"), exports);
|
|
25
|
+
__exportStar(require("./query-builder/update-query-builder.js"), exports);
|
|
26
|
+
__exportStar(require("./query-builder/delete-query-builder.js"), exports);
|
|
27
|
+
__exportStar(require("./query-builder/no-result-error.js"), exports);
|
|
28
|
+
__exportStar(require("./query-builder/join-builder.js"), exports);
|
|
29
|
+
__exportStar(require("./query-builder/expression-builder.js"), exports);
|
|
30
|
+
__exportStar(require("./query-builder/function-builder.js"), exports);
|
|
31
|
+
__exportStar(require("./query-builder/insert-result.js"), exports);
|
|
32
|
+
__exportStar(require("./query-builder/delete-result.js"), exports);
|
|
33
|
+
__exportStar(require("./query-builder/update-result.js"), exports);
|
|
34
|
+
__exportStar(require("./query-builder/on-conflict-builder.js"), exports);
|
|
35
|
+
__exportStar(require("./raw-builder/raw-builder.js"), exports);
|
|
36
|
+
__exportStar(require("./raw-builder/sql.js"), exports);
|
|
37
|
+
__exportStar(require("./query-executor/query-executor.js"), exports);
|
|
38
|
+
__exportStar(require("./query-executor/default-query-executor.js"), exports);
|
|
39
|
+
__exportStar(require("./query-executor/noop-query-executor.js"), exports);
|
|
40
|
+
__exportStar(require("./query-executor/query-executor-provider.js"), exports);
|
|
41
|
+
__exportStar(require("./query-compiler/default-query-compiler.js"), exports);
|
|
42
|
+
__exportStar(require("./query-compiler/compiled-query.js"), exports);
|
|
43
|
+
__exportStar(require("./schema/schema.js"), exports);
|
|
44
|
+
__exportStar(require("./schema/create-table-builder.js"), exports);
|
|
45
|
+
__exportStar(require("./schema/drop-table-builder.js"), exports);
|
|
46
|
+
__exportStar(require("./schema/create-index-builder.js"), exports);
|
|
47
|
+
__exportStar(require("./schema/drop-index-builder.js"), exports);
|
|
48
|
+
__exportStar(require("./schema/create-schema-builder.js"), exports);
|
|
49
|
+
__exportStar(require("./schema/drop-schema-builder.js"), exports);
|
|
50
|
+
__exportStar(require("./schema/column-definition-builder.js"), exports);
|
|
51
|
+
__exportStar(require("./schema/foreign-key-constraint-builder.js"), exports);
|
|
52
|
+
__exportStar(require("./schema/alter-table-builder.js"), exports);
|
|
53
|
+
__exportStar(require("./schema/create-view-builder.js"), exports);
|
|
54
|
+
__exportStar(require("./schema/drop-view-builder.js"), exports);
|
|
55
|
+
__exportStar(require("./dynamic/dynamic.js"), exports);
|
|
56
|
+
__exportStar(require("./driver/driver.js"), exports);
|
|
57
|
+
__exportStar(require("./driver/database-connection.js"), exports);
|
|
58
|
+
__exportStar(require("./driver/connection-provider.js"), exports);
|
|
59
|
+
__exportStar(require("./driver/default-connection-provider.js"), exports);
|
|
60
|
+
__exportStar(require("./driver/single-connection-provider.js"), exports);
|
|
61
|
+
__exportStar(require("./driver/dummy-driver.js"), exports);
|
|
62
|
+
__exportStar(require("./dialect/dialect.js"), exports);
|
|
63
|
+
__exportStar(require("./dialect/dialect-adapter.js"), exports);
|
|
64
|
+
__exportStar(require("./dialect/dialect-adapter-base.js"), exports);
|
|
65
|
+
__exportStar(require("./dialect/database-introspector.js"), exports);
|
|
15
66
|
__exportStar(require("./dialect/sqlite/sqlite-dialect.js"), exports);
|
|
16
67
|
__exportStar(require("./dialect/sqlite/sqlite-dialect-config.js"), exports);
|
|
17
68
|
__exportStar(require("./dialect/sqlite/sqlite-driver.js"), exports);
|
|
69
|
+
__exportStar(require("./dialect/postgres/postgres-query-compiler.js"), exports);
|
|
70
|
+
__exportStar(require("./dialect/postgres/postgres-introspector.js"), exports);
|
|
71
|
+
__exportStar(require("./dialect/postgres/postgres-adapter.js"), exports);
|
|
18
72
|
__exportStar(require("./dialect/mysql/mysql-dialect.js"), exports);
|
|
19
73
|
__exportStar(require("./dialect/mysql/mysql-dialect-config.js"), exports);
|
|
20
74
|
__exportStar(require("./dialect/mysql/mysql-driver.js"), exports);
|
|
75
|
+
__exportStar(require("./dialect/mysql/mysql-query-compiler.js"), exports);
|
|
76
|
+
__exportStar(require("./dialect/mysql/mysql-introspector.js"), exports);
|
|
77
|
+
__exportStar(require("./dialect/mysql/mysql-adapter.js"), exports);
|
|
21
78
|
__exportStar(require("./dialect/postgres/postgres-driver.js"), exports);
|
|
22
79
|
__exportStar(require("./dialect/postgres/postgres-dialect-config.js"), exports);
|
|
23
80
|
__exportStar(require("./dialect/postgres/postgres-dialect.js"), exports);
|
|
81
|
+
__exportStar(require("./dialect/sqlite/sqlite-query-compiler.js"), exports);
|
|
82
|
+
__exportStar(require("./dialect/sqlite/sqlite-introspector.js"), exports);
|
|
83
|
+
__exportStar(require("./dialect/sqlite/sqlite-adapter.js"), exports);
|
|
84
|
+
__exportStar(require("./query-compiler/default-query-compiler.js"), exports);
|
|
85
|
+
__exportStar(require("./query-compiler/query-compiler.js"), exports);
|
|
86
|
+
__exportStar(require("./migration/migrator.js"), exports);
|
|
87
|
+
__exportStar(require("./migration/file-migration-provider.js"), exports);
|
|
88
|
+
__exportStar(require("./plugin/kysely-plugin.js"), exports);
|
|
89
|
+
__exportStar(require("./plugin/camel-case/camel-case-plugin.js"), exports);
|
|
90
|
+
__exportStar(require("./plugin/deduplicate-joins/deduplicate-joins-plugin.js"), exports);
|
|
91
|
+
__exportStar(require("./operation-node/add-column-node.js"), exports);
|
|
92
|
+
__exportStar(require("./operation-node/add-constraint-node.js"), exports);
|
|
93
|
+
__exportStar(require("./operation-node/alias-node.js"), exports);
|
|
94
|
+
__exportStar(require("./operation-node/alter-column-node.js"), exports);
|
|
95
|
+
__exportStar(require("./operation-node/alter-table-node.js"), exports);
|
|
96
|
+
__exportStar(require("./operation-node/and-node.js"), exports);
|
|
97
|
+
__exportStar(require("./operation-node/check-constraint-node.js"), exports);
|
|
98
|
+
__exportStar(require("./operation-node/column-definition-node.js"), exports);
|
|
99
|
+
__exportStar(require("./operation-node/column-node.js"), exports);
|
|
100
|
+
__exportStar(require("./operation-node/column-update-node.js"), exports);
|
|
101
|
+
__exportStar(require("./operation-node/common-table-expression-node.js"), exports);
|
|
102
|
+
__exportStar(require("./operation-node/common-table-expression-name-node.js"), exports);
|
|
103
|
+
__exportStar(require("./operation-node/constraint-node.js"), exports);
|
|
104
|
+
__exportStar(require("./operation-node/create-index-node.js"), exports);
|
|
105
|
+
__exportStar(require("./operation-node/create-schema-node.js"), exports);
|
|
106
|
+
__exportStar(require("./operation-node/create-table-node.js"), exports);
|
|
107
|
+
__exportStar(require("./operation-node/create-view-node.js"), exports);
|
|
108
|
+
__exportStar(require("./operation-node/data-type-node.js"), exports);
|
|
109
|
+
__exportStar(require("./operation-node/default-value-node.js"), exports);
|
|
110
|
+
__exportStar(require("./operation-node/delete-query-node.js"), exports);
|
|
111
|
+
__exportStar(require("./operation-node/drop-column-node.js"), exports);
|
|
112
|
+
__exportStar(require("./operation-node/drop-constraint-node.js"), exports);
|
|
113
|
+
__exportStar(require("./operation-node/drop-index-node.js"), exports);
|
|
114
|
+
__exportStar(require("./operation-node/drop-schema-node.js"), exports);
|
|
115
|
+
__exportStar(require("./operation-node/drop-table-node.js"), exports);
|
|
116
|
+
__exportStar(require("./operation-node/drop-view-node.js"), exports);
|
|
117
|
+
__exportStar(require("./operation-node/filter-node.js"), exports);
|
|
118
|
+
__exportStar(require("./operation-node/foreign-key-constraint-node.js"), exports);
|
|
119
|
+
__exportStar(require("./operation-node/from-node.js"), exports);
|
|
120
|
+
__exportStar(require("./operation-node/generated-node.js"), exports);
|
|
121
|
+
__exportStar(require("./operation-node/group-by-item-node.js"), exports);
|
|
122
|
+
__exportStar(require("./operation-node/group-by-node.js"), exports);
|
|
123
|
+
__exportStar(require("./operation-node/having-node.js"), exports);
|
|
124
|
+
__exportStar(require("./operation-node/identifier-node.js"), exports);
|
|
125
|
+
__exportStar(require("./operation-node/insert-query-node.js"), exports);
|
|
126
|
+
__exportStar(require("./operation-node/join-node.js"), exports);
|
|
127
|
+
__exportStar(require("./operation-node/limit-node.js"), exports);
|
|
128
|
+
__exportStar(require("./operation-node/list-node.js"), exports);
|
|
129
|
+
__exportStar(require("./operation-node/modify-column-node.js"), exports);
|
|
130
|
+
__exportStar(require("./operation-node/offset-node.js"), exports);
|
|
131
|
+
__exportStar(require("./operation-node/on-conflict-node.js"), exports);
|
|
132
|
+
__exportStar(require("./operation-node/on-duplicate-key-node.js"), exports);
|
|
133
|
+
__exportStar(require("./operation-node/on-node.js"), exports);
|
|
134
|
+
__exportStar(require("./operation-node/operation-node-source.js"), exports);
|
|
135
|
+
__exportStar(require("./operation-node/operation-node-transformer.js"), exports);
|
|
136
|
+
__exportStar(require("./operation-node/operation-node-utils.js"), exports);
|
|
137
|
+
__exportStar(require("./operation-node/operation-node-visitor.js"), exports);
|
|
138
|
+
__exportStar(require("./operation-node/operation-node.js"), exports);
|
|
139
|
+
__exportStar(require("./operation-node/operator-node.js"), exports);
|
|
140
|
+
__exportStar(require("./operation-node/or-node.js"), exports);
|
|
141
|
+
__exportStar(require("./operation-node/order-by-item-node.js"), exports);
|
|
142
|
+
__exportStar(require("./operation-node/order-by-node.js"), exports);
|
|
143
|
+
__exportStar(require("./operation-node/parens-node.js"), exports);
|
|
144
|
+
__exportStar(require("./operation-node/primary-constraint-node.js"), exports);
|
|
145
|
+
__exportStar(require("./operation-node/primitive-value-list-node.js"), exports);
|
|
146
|
+
__exportStar(require("./operation-node/query-node.js"), exports);
|
|
147
|
+
__exportStar(require("./operation-node/raw-node.js"), exports);
|
|
148
|
+
__exportStar(require("./operation-node/reference-node.js"), exports);
|
|
149
|
+
__exportStar(require("./operation-node/references-node.js"), exports);
|
|
150
|
+
__exportStar(require("./operation-node/rename-column-node.js"), exports);
|
|
151
|
+
__exportStar(require("./operation-node/returning-node.js"), exports);
|
|
152
|
+
__exportStar(require("./operation-node/select-all-node.js"), exports);
|
|
153
|
+
__exportStar(require("./operation-node/select-query-node.js"), exports);
|
|
154
|
+
__exportStar(require("./operation-node/select-query-node.js"), exports);
|
|
155
|
+
__exportStar(require("./operation-node/selection-node.js"), exports);
|
|
156
|
+
__exportStar(require("./operation-node/table-node.js"), exports);
|
|
157
|
+
__exportStar(require("./operation-node/union-node.js"), exports);
|
|
158
|
+
__exportStar(require("./operation-node/unique-constraint-node.js"), exports);
|
|
159
|
+
__exportStar(require("./operation-node/update-query-node.js"), exports);
|
|
160
|
+
__exportStar(require("./operation-node/value-list-node.js"), exports);
|
|
161
|
+
__exportStar(require("./operation-node/value-node.js"), exports);
|
|
162
|
+
__exportStar(require("./operation-node/values-node.js"), exports);
|
|
163
|
+
__exportStar(require("./operation-node/where-node.js"), exports);
|
|
164
|
+
__exportStar(require("./operation-node/with-node.js"), exports);
|
|
165
|
+
__exportStar(require("./util/column-type.js"), exports);
|
|
166
|
+
__exportStar(require("./util/compilable.js"), exports);
|
|
167
|
+
__exportStar(require("./util/log.js"), exports);
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { Migration, MigrationProvider } from './migrator.js';
|
|
2
2
|
/**
|
|
3
|
-
* Reads all migrations from a folder.
|
|
3
|
+
* Reads all migrations from a folder in node.js.
|
|
4
4
|
*
|
|
5
5
|
* ### Examples
|
|
6
6
|
*
|
|
7
7
|
* ```ts
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* import { promises as fs } from 'fs'
|
|
9
|
+
* import path from 'path'
|
|
10
|
+
*
|
|
11
|
+
* new FileMigrationProvider({
|
|
12
|
+
* fs,
|
|
13
|
+
* path,
|
|
14
|
+
* migrationFolder: 'path/to/migrations/folder'
|
|
15
|
+
* })
|
|
11
16
|
* ```
|
|
12
17
|
*/
|
|
13
18
|
export declare class FileMigrationProvider implements MigrationProvider {
|
|
14
19
|
#private;
|
|
15
|
-
constructor(
|
|
20
|
+
constructor(props: FileMigrationProviderProps);
|
|
16
21
|
/**
|
|
17
22
|
* Returns all migrations, old and new.
|
|
18
23
|
*
|
|
@@ -27,3 +32,14 @@ export declare class FileMigrationProvider implements MigrationProvider {
|
|
|
27
32
|
*/
|
|
28
33
|
getMigrations(): Promise<Record<string, Migration>>;
|
|
29
34
|
}
|
|
35
|
+
export interface FileMigrationProviderFS {
|
|
36
|
+
readdir(path: string): Promise<string[]>;
|
|
37
|
+
}
|
|
38
|
+
export interface FileMigrationProviderPath {
|
|
39
|
+
join(...path: string[]): string;
|
|
40
|
+
}
|
|
41
|
+
export interface FileMigrationProviderProps {
|
|
42
|
+
fs: FileMigrationProviderFS;
|
|
43
|
+
path: FileMigrationProviderPath;
|
|
44
|
+
migrationFolder: string;
|
|
45
|
+
}
|
|
@@ -3,32 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FileMigrationProvider = void 0;
|
|
4
4
|
const object_utils_js_1 = require("../util/object-utils.js");
|
|
5
5
|
/**
|
|
6
|
-
* Reads all migrations from a folder.
|
|
6
|
+
* Reads all migrations from a folder in node.js.
|
|
7
7
|
*
|
|
8
8
|
* ### Examples
|
|
9
9
|
*
|
|
10
10
|
* ```ts
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* import { promises as fs } from 'fs'
|
|
12
|
+
* import path from 'path'
|
|
13
|
+
*
|
|
14
|
+
* new FileMigrationProvider({
|
|
15
|
+
* fs,
|
|
16
|
+
* path,
|
|
17
|
+
* migrationFolder: 'path/to/migrations/folder'
|
|
18
|
+
* })
|
|
14
19
|
* ```
|
|
15
20
|
*/
|
|
16
21
|
class FileMigrationProvider {
|
|
17
|
-
#
|
|
18
|
-
constructor(
|
|
19
|
-
this.#
|
|
22
|
+
#props;
|
|
23
|
+
constructor(props) {
|
|
24
|
+
this.#props = props;
|
|
20
25
|
}
|
|
21
26
|
async getMigrations() {
|
|
22
|
-
// Import these dynamically so that we don't have any top level
|
|
23
|
-
// node dependencies.
|
|
24
|
-
const fs = await Promise.resolve().then(() => require('fs/promises'));
|
|
25
|
-
const path = await Promise.resolve().then(() => require('path'));
|
|
26
27
|
const migrations = {};
|
|
27
|
-
const files = await fs.readdir(this.#
|
|
28
|
+
const files = await this.#props.fs.readdir(this.#props.migrationFolder);
|
|
28
29
|
for (const fileName of files) {
|
|
29
30
|
if ((fileName.endsWith('.js') || fileName.endsWith('.ts')) &&
|
|
30
31
|
!fileName.endsWith('.d.ts')) {
|
|
31
|
-
const migration = await Promise.resolve().then(() => require(path.join(this.#
|
|
32
|
+
const migration = await Promise.resolve().then(() => require(this.#props.path.join(this.#props.migrationFolder, fileName)));
|
|
32
33
|
if (isMigration(migration)) {
|
|
33
34
|
migrations[fileName.substring(0, fileName.length - 3)] = migration;
|
|
34
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Kysely } from '../kysely.js';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const DEFAULT_MIGRATION_TABLE = "kysely_migration";
|
|
3
|
+
export declare const DEFAULT_MIGRATION_LOCK_TABLE = "kysely_migration_lock";
|
|
4
4
|
export declare const MIGRATION_LOCK_ID = "migration_lock";
|
|
5
5
|
export declare const NO_MIGRATIONS: NoMigrations;
|
|
6
6
|
export interface Migration {
|
|
@@ -148,6 +148,48 @@ export declare class Migrator {
|
|
|
148
148
|
export interface MigratorProps {
|
|
149
149
|
readonly db: Kysely<any>;
|
|
150
150
|
readonly provider: MigrationProvider;
|
|
151
|
+
/**
|
|
152
|
+
* The name of the internal migration table. Defaults to `kysely_migration`.
|
|
153
|
+
*
|
|
154
|
+
* If you do specify this, you need to ALWAYS use the same value. Kysely doesn't
|
|
155
|
+
* support changing the table on the fly. If you run the migrator even once with a
|
|
156
|
+
* table name X and then change the table name to Y, kysely will create a new empty
|
|
157
|
+
* migration table and attempt to run the migrations again, which will obviously
|
|
158
|
+
* fail.
|
|
159
|
+
*
|
|
160
|
+
* If you do specify this, ALWAYS ALWAYS use the same value from the beginning of
|
|
161
|
+
* the project, to the end of time or prepare to manually migrate the migration
|
|
162
|
+
* tables.
|
|
163
|
+
*/
|
|
164
|
+
readonly migrationTableName?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The name of the internal migration lock table. Defaults to `kysely_migration_lock`.
|
|
167
|
+
*
|
|
168
|
+
* If you do specify this, you need to ALWAYS use the same value. Kysely doesn't
|
|
169
|
+
* support changing the table on the fly. If you run the migrator even once with a
|
|
170
|
+
* table name X and then change the table name to Y, kysely will create a new empty
|
|
171
|
+
* lock table.
|
|
172
|
+
*
|
|
173
|
+
* If you do specify this, ALWAYS ALWAYS use the same value from the beginning of
|
|
174
|
+
* the project, to the end of time or prepare to manually migrate the migration
|
|
175
|
+
* tables.
|
|
176
|
+
*/
|
|
177
|
+
readonly migrationLockTableName?: string;
|
|
178
|
+
/**
|
|
179
|
+
* The schema of the internal migration tables. Defaults to the default schema
|
|
180
|
+
* on dialects that support schemas.
|
|
181
|
+
*
|
|
182
|
+
* If you do specify this, you need to ALWAYS use the same value. Kysely doesn't
|
|
183
|
+
* support changing the schema on the fly. If you run the migrator even once with a
|
|
184
|
+
* schema name X and then change the schema name to Y, kysely will create a new empty
|
|
185
|
+
* migration tables in the new schema and attempt to run the migrations again, which
|
|
186
|
+
* will obviously fail.
|
|
187
|
+
*
|
|
188
|
+
* If you do specify this, ALWAYS ALWAYS use the same value from the beginning of
|
|
189
|
+
* the project, to the end of time or prepare to manually migrate the migration
|
|
190
|
+
* tables.
|
|
191
|
+
*/
|
|
192
|
+
readonly migrationTableSchema?: string;
|
|
151
193
|
}
|
|
152
194
|
/**
|
|
153
195
|
* All migration methods ({@link Migrator.migrateTo | migrateTo},
|