kysely 0.12.0 → 0.12.1
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/dist/cjs/dialect/dialect-adapter-base.d.ts +36 -0
- package/dist/cjs/dialect/mysql/mysql-adapter.d.ts +36 -0
- package/dist/cjs/dialect/mysql/mysql-dialect.d.ts +16 -0
- package/dist/cjs/dialect/mysql/mysql-driver.d.ts +29 -0
- package/dist/cjs/dialect/mysql/mysql-introspector.d.ts +3 -0
- package/dist/cjs/dialect/postgres/postgres-adapter.d.ts +36 -0
- package/dist/cjs/dialect/postgres/postgres-dialect.d.ts +16 -0
- package/dist/cjs/dialect/postgres/postgres-driver.d.ts +29 -0
- package/dist/cjs/dialect/postgres/postgres-introspector.d.ts +3 -0
- package/dist/cjs/dialect/sqlite/sqlite-adapter.d.ts +36 -0
- package/dist/cjs/dialect/sqlite/sqlite-dialect.d.ts +16 -0
- package/dist/cjs/dialect/sqlite/sqlite-driver.d.ts +29 -0
- package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +3 -0
- package/dist/cjs/driver/default-connection-provider.d.ts +4 -0
- package/dist/cjs/driver/runtime-driver.d.ts +29 -0
- package/dist/cjs/driver/single-connection-provider.d.ts +4 -0
- package/dist/cjs/package.json +1 -3
- package/dist/cjs/parser/parse-context.d.ts +14 -0
- package/dist/cjs/plugin/camel-case/camel-case-plugin.d.ts +34 -0
- package/dist/cjs/plugin/immediate-value.ts/immediate-value-plugin.d.ts +34 -0
- package/dist/cjs/plugin/with-schema/with-schema-plugin.d.ts +34 -0
- package/dist/cjs/query-builder/delete-query-builder.d.ts +545 -0
- package/dist/cjs/query-builder/insert-query-builder.d.ts +69 -4
- package/dist/cjs/query-builder/join-interface.d.ts +3 -6
- package/dist/cjs/query-builder/returning-interface.d.ts +1 -1
- package/dist/cjs/query-builder/select-query-builder.d.ts +513 -2
- package/dist/cjs/query-builder/select-query-builder.js +2 -2
- package/dist/cjs/query-builder/update-query-builder.d.ts +547 -2
- package/dist/cjs/query-builder/update-query-builder.js +2 -2
- package/dist/cjs/query-builder/where-interface.d.ts +7 -10
- package/dist/cjs/schema/alter-table-builder.d.ts +216 -0
- package/dist/cjs/schema/column-definition-builder.d.ts +108 -0
- package/dist/esm/dialect/dialect-adapter-base.d.ts +36 -0
- package/dist/esm/dialect/mysql/mysql-adapter.d.ts +36 -0
- package/dist/esm/dialect/mysql/mysql-dialect.d.ts +16 -0
- package/dist/esm/dialect/mysql/mysql-driver.d.ts +29 -0
- package/dist/esm/dialect/mysql/mysql-introspector.d.ts +3 -0
- package/dist/esm/dialect/postgres/postgres-adapter.d.ts +36 -0
- package/dist/esm/dialect/postgres/postgres-dialect.d.ts +16 -0
- package/dist/esm/dialect/postgres/postgres-driver.d.ts +29 -0
- package/dist/esm/dialect/postgres/postgres-introspector.d.ts +3 -0
- package/dist/esm/dialect/sqlite/sqlite-adapter.d.ts +36 -0
- package/dist/esm/dialect/sqlite/sqlite-dialect.d.ts +16 -0
- package/dist/esm/dialect/sqlite/sqlite-driver.d.ts +29 -0
- package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +3 -0
- package/dist/esm/driver/default-connection-provider.d.ts +4 -0
- package/dist/esm/driver/runtime-driver.d.ts +29 -0
- package/dist/esm/driver/single-connection-provider.d.ts +4 -0
- package/dist/esm/package.json +1 -3
- package/dist/esm/parser/parse-context.d.ts +14 -0
- package/dist/esm/plugin/camel-case/camel-case-plugin.d.ts +34 -0
- package/dist/esm/plugin/immediate-value.ts/immediate-value-plugin.d.ts +34 -0
- package/dist/esm/plugin/with-schema/with-schema-plugin.d.ts +34 -0
- package/dist/esm/query-builder/delete-query-builder.d.ts +545 -0
- package/dist/esm/query-builder/insert-query-builder.d.ts +69 -4
- package/dist/esm/query-builder/join-interface.d.ts +3 -6
- package/dist/esm/query-builder/returning-interface.d.ts +1 -1
- package/dist/esm/query-builder/select-query-builder.d.ts +513 -2
- package/dist/esm/query-builder/select-query-builder.js +2 -2
- package/dist/esm/query-builder/update-query-builder.d.ts +547 -2
- package/dist/esm/query-builder/update-query-builder.js +2 -2
- package/dist/esm/query-builder/where-interface.d.ts +7 -10
- package/dist/esm/schema/alter-table-builder.d.ts +216 -0
- package/dist/esm/schema/column-definition-builder.d.ts +108 -0
- package/package.json +7 -5
|
@@ -63,16 +63,124 @@ export interface AlterTableExecutorProps extends AlterTableBuilderProps {
|
|
|
63
63
|
export declare class AlterTableAddColumnBuilder implements ColumnDefinitionBuilderInterface, OperationNodeSource, Compilable {
|
|
64
64
|
#private;
|
|
65
65
|
constructor(props: AlterTableAddColumnBuilderProps);
|
|
66
|
+
/**
|
|
67
|
+
* Adds `auto_increment` or `autoincrement` to the column definition
|
|
68
|
+
* depending on the dialect.
|
|
69
|
+
*
|
|
70
|
+
* Some dialects like PostgreSQL don't support this. On PostgreSQL
|
|
71
|
+
* you can use the `serial` or `bigserial` data type instead.
|
|
72
|
+
*/
|
|
66
73
|
autoIncrement(): AlterTableAddColumnBuilder;
|
|
74
|
+
/**
|
|
75
|
+
* Makes the column the primary key.
|
|
76
|
+
*
|
|
77
|
+
* If you want to specify a composite primary key use the
|
|
78
|
+
* {@link TableBuilder.addPrimaryKeyConstraint} method.
|
|
79
|
+
*/
|
|
67
80
|
primaryKey(): AlterTableAddColumnBuilder;
|
|
81
|
+
/**
|
|
82
|
+
* Adds a foreign key constraint for the column.
|
|
83
|
+
*
|
|
84
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
85
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
86
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
87
|
+
*
|
|
88
|
+
* ### Examples
|
|
89
|
+
*
|
|
90
|
+
* ```ts
|
|
91
|
+
* col.references('person.id')
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
68
94
|
references(ref: string): AlterTableAddColumnBuilder;
|
|
95
|
+
/**
|
|
96
|
+
* Adds an `on delete` constraint for the foreign key column.
|
|
97
|
+
*
|
|
98
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
99
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
100
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
101
|
+
*
|
|
102
|
+
* ### Examples
|
|
103
|
+
*
|
|
104
|
+
* ```ts
|
|
105
|
+
* col.references('person.id').onDelete('cascade')
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
69
108
|
onDelete(onDelete: OnModifyForeignAction): AlterTableAddColumnBuilder;
|
|
109
|
+
/**
|
|
110
|
+
* Adds an `on update` constraint for the foreign key column.
|
|
111
|
+
*
|
|
112
|
+
* ### Examples
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* col.references('person.id').onUpdate('cascade')
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
70
118
|
onUpdate(onDelete: OnModifyForeignAction): AlterTableAddColumnBuilder;
|
|
119
|
+
/**
|
|
120
|
+
* Adds a unique constraint for the column.
|
|
121
|
+
*/
|
|
71
122
|
unique(): AlterTableAddColumnBuilder;
|
|
123
|
+
/**
|
|
124
|
+
* Adds a `not null` constraint for the column.
|
|
125
|
+
*/
|
|
72
126
|
notNull(): AlterTableAddColumnBuilder;
|
|
127
|
+
/**
|
|
128
|
+
* Adds a default value constraint for the column.
|
|
129
|
+
*
|
|
130
|
+
* ### Examples
|
|
131
|
+
*
|
|
132
|
+
* ```ts
|
|
133
|
+
* db.schema
|
|
134
|
+
* .createTable('pet')
|
|
135
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.defaultTo(4))
|
|
136
|
+
* .execute()
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
73
139
|
defaultTo(value: PrimitiveValue | AnyRawBuilder): AlterTableAddColumnBuilder;
|
|
140
|
+
/**
|
|
141
|
+
* Adds a check constraint for the column.
|
|
142
|
+
*
|
|
143
|
+
* ### Examples
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* db.schema
|
|
147
|
+
* .createTable('pet')
|
|
148
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.check('number_of_legs < 5'))
|
|
149
|
+
* .execute()
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
74
152
|
check(sql: string): AlterTableAddColumnBuilder;
|
|
153
|
+
/**
|
|
154
|
+
* Makes the column a generated column using a `generated always as` statement.
|
|
155
|
+
*
|
|
156
|
+
* ### Examples
|
|
157
|
+
*
|
|
158
|
+
* ```ts
|
|
159
|
+
* db.schema
|
|
160
|
+
* .createTable('person')
|
|
161
|
+
* .addColumn('full_name', 'varchar(255)',
|
|
162
|
+
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
163
|
+
* )
|
|
164
|
+
* .execute()
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
75
167
|
generatedAlwaysAs(sql: string): AlterTableAddColumnBuilder;
|
|
168
|
+
/**
|
|
169
|
+
* Makes a generated column stored instead of virtual. This method can only
|
|
170
|
+
* be used with {@link generatedAlwaysAs}
|
|
171
|
+
*
|
|
172
|
+
* ### Examples
|
|
173
|
+
*
|
|
174
|
+
* ```ts
|
|
175
|
+
* db.schema
|
|
176
|
+
* .createTable('person')
|
|
177
|
+
* .addColumn('full_name', 'varchar(255)', (col) => col
|
|
178
|
+
* .generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
179
|
+
* .stored()
|
|
180
|
+
* )
|
|
181
|
+
* .execute()
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
76
184
|
stored(): AlterTableAddColumnBuilder;
|
|
77
185
|
toOperationNode(): AlterTableNode;
|
|
78
186
|
compile(): CompiledQuery;
|
|
@@ -84,16 +192,124 @@ export interface AlterTableAddColumnBuilderProps extends AlterTableBuilderProps
|
|
|
84
192
|
export declare class AlterTableModifyColumnBuilder implements ColumnDefinitionBuilderInterface, OperationNodeSource, Compilable {
|
|
85
193
|
#private;
|
|
86
194
|
constructor(props: AlterTableModifyColumnBuilderProps);
|
|
195
|
+
/**
|
|
196
|
+
* Adds `auto_increment` or `autoincrement` to the column definition
|
|
197
|
+
* depending on the dialect.
|
|
198
|
+
*
|
|
199
|
+
* Some dialects like PostgreSQL don't support this. On PostgreSQL
|
|
200
|
+
* you can use the `serial` or `bigserial` data type instead.
|
|
201
|
+
*/
|
|
87
202
|
autoIncrement(): AlterTableModifyColumnBuilder;
|
|
203
|
+
/**
|
|
204
|
+
* Makes the column the primary key.
|
|
205
|
+
*
|
|
206
|
+
* If you want to specify a composite primary key use the
|
|
207
|
+
* {@link TableBuilder.addPrimaryKeyConstraint} method.
|
|
208
|
+
*/
|
|
88
209
|
primaryKey(): AlterTableModifyColumnBuilder;
|
|
210
|
+
/**
|
|
211
|
+
* Adds a foreign key constraint for the column.
|
|
212
|
+
*
|
|
213
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
214
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
215
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
216
|
+
*
|
|
217
|
+
* ### Examples
|
|
218
|
+
*
|
|
219
|
+
* ```ts
|
|
220
|
+
* col.references('person.id')
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
89
223
|
references(ref: string): AlterTableModifyColumnBuilder;
|
|
224
|
+
/**
|
|
225
|
+
* Adds an `on delete` constraint for the foreign key column.
|
|
226
|
+
*
|
|
227
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
228
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
229
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
230
|
+
*
|
|
231
|
+
* ### Examples
|
|
232
|
+
*
|
|
233
|
+
* ```ts
|
|
234
|
+
* col.references('person.id').onDelete('cascade')
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
90
237
|
onDelete(onDelete: OnModifyForeignAction): AlterTableModifyColumnBuilder;
|
|
238
|
+
/**
|
|
239
|
+
* Adds an `on update` constraint for the foreign key column.
|
|
240
|
+
*
|
|
241
|
+
* ### Examples
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* col.references('person.id').onUpdate('cascade')
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
91
247
|
onUpdate(onUpdate: OnModifyForeignAction): AlterTableModifyColumnBuilder;
|
|
248
|
+
/**
|
|
249
|
+
* Adds a unique constraint for the column.
|
|
250
|
+
*/
|
|
92
251
|
unique(): AlterTableModifyColumnBuilder;
|
|
252
|
+
/**
|
|
253
|
+
* Adds a `not null` constraint for the column.
|
|
254
|
+
*/
|
|
93
255
|
notNull(): AlterTableModifyColumnBuilder;
|
|
256
|
+
/**
|
|
257
|
+
* Adds a default value constraint for the column.
|
|
258
|
+
*
|
|
259
|
+
* ### Examples
|
|
260
|
+
*
|
|
261
|
+
* ```ts
|
|
262
|
+
* db.schema
|
|
263
|
+
* .createTable('pet')
|
|
264
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.defaultTo(4))
|
|
265
|
+
* .execute()
|
|
266
|
+
* ```
|
|
267
|
+
*/
|
|
94
268
|
defaultTo(value: PrimitiveValue | AnyRawBuilder): AlterTableModifyColumnBuilder;
|
|
269
|
+
/**
|
|
270
|
+
* Adds a check constraint for the column.
|
|
271
|
+
*
|
|
272
|
+
* ### Examples
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* db.schema
|
|
276
|
+
* .createTable('pet')
|
|
277
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.check('number_of_legs < 5'))
|
|
278
|
+
* .execute()
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
95
281
|
check(sql: string): AlterTableModifyColumnBuilder;
|
|
282
|
+
/**
|
|
283
|
+
* Makes the column a generated column using a `generated always as` statement.
|
|
284
|
+
*
|
|
285
|
+
* ### Examples
|
|
286
|
+
*
|
|
287
|
+
* ```ts
|
|
288
|
+
* db.schema
|
|
289
|
+
* .createTable('person')
|
|
290
|
+
* .addColumn('full_name', 'varchar(255)',
|
|
291
|
+
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
292
|
+
* )
|
|
293
|
+
* .execute()
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
96
296
|
generatedAlwaysAs(sql: string): AlterTableModifyColumnBuilder;
|
|
297
|
+
/**
|
|
298
|
+
* Makes a generated column stored instead of virtual. This method can only
|
|
299
|
+
* be used with {@link generatedAlwaysAs}
|
|
300
|
+
*
|
|
301
|
+
* ### Examples
|
|
302
|
+
*
|
|
303
|
+
* ```ts
|
|
304
|
+
* db.schema
|
|
305
|
+
* .createTable('person')
|
|
306
|
+
* .addColumn('full_name', 'varchar(255)', (col) => col
|
|
307
|
+
* .generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
308
|
+
* .stored()
|
|
309
|
+
* )
|
|
310
|
+
* .execute()
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
97
313
|
stored(): AlterTableModifyColumnBuilder;
|
|
98
314
|
toOperationNode(): AlterTableNode;
|
|
99
315
|
compile(): CompiledQuery;
|
|
@@ -128,16 +128,124 @@ export interface ColumnDefinitionBuilderInterface {
|
|
|
128
128
|
export declare class ColumnDefinitionBuilder implements ColumnDefinitionBuilderInterface, OperationNodeSource {
|
|
129
129
|
#private;
|
|
130
130
|
constructor(node: ColumnDefinitionNode);
|
|
131
|
+
/**
|
|
132
|
+
* Adds `auto_increment` or `autoincrement` to the column definition
|
|
133
|
+
* depending on the dialect.
|
|
134
|
+
*
|
|
135
|
+
* Some dialects like PostgreSQL don't support this. On PostgreSQL
|
|
136
|
+
* you can use the `serial` or `bigserial` data type instead.
|
|
137
|
+
*/
|
|
131
138
|
autoIncrement(): ColumnDefinitionBuilder;
|
|
139
|
+
/**
|
|
140
|
+
* Makes the column the primary key.
|
|
141
|
+
*
|
|
142
|
+
* If you want to specify a composite primary key use the
|
|
143
|
+
* {@link TableBuilder.addPrimaryKeyConstraint} method.
|
|
144
|
+
*/
|
|
132
145
|
primaryKey(): ColumnDefinitionBuilder;
|
|
146
|
+
/**
|
|
147
|
+
* Adds a foreign key constraint for the column.
|
|
148
|
+
*
|
|
149
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
150
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
151
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
152
|
+
*
|
|
153
|
+
* ### Examples
|
|
154
|
+
*
|
|
155
|
+
* ```ts
|
|
156
|
+
* col.references('person.id')
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
133
159
|
references(ref: string): ColumnDefinitionBuilder;
|
|
160
|
+
/**
|
|
161
|
+
* Adds an `on delete` constraint for the foreign key column.
|
|
162
|
+
*
|
|
163
|
+
* If your database engine doesn't support foreign key constraints in the
|
|
164
|
+
* column definition (like MySQL 5) you need to call the table level
|
|
165
|
+
* {@link TableBuilder.addForeignKeyConstraint} method instead.
|
|
166
|
+
*
|
|
167
|
+
* ### Examples
|
|
168
|
+
*
|
|
169
|
+
* ```ts
|
|
170
|
+
* col.references('person.id').onDelete('cascade')
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
134
173
|
onDelete(onDelete: OnModifyForeignAction): ColumnDefinitionBuilder;
|
|
174
|
+
/**
|
|
175
|
+
* Adds an `on update` constraint for the foreign key column.
|
|
176
|
+
*
|
|
177
|
+
* ### Examples
|
|
178
|
+
*
|
|
179
|
+
* ```ts
|
|
180
|
+
* col.references('person.id').onUpdate('cascade')
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
135
183
|
onUpdate(onUpdate: OnModifyForeignAction): ColumnDefinitionBuilder;
|
|
184
|
+
/**
|
|
185
|
+
* Adds a unique constraint for the column.
|
|
186
|
+
*/
|
|
136
187
|
unique(): ColumnDefinitionBuilder;
|
|
188
|
+
/**
|
|
189
|
+
* Adds a `not null` constraint for the column.
|
|
190
|
+
*/
|
|
137
191
|
notNull(): ColumnDefinitionBuilder;
|
|
192
|
+
/**
|
|
193
|
+
* Adds a default value constraint for the column.
|
|
194
|
+
*
|
|
195
|
+
* ### Examples
|
|
196
|
+
*
|
|
197
|
+
* ```ts
|
|
198
|
+
* db.schema
|
|
199
|
+
* .createTable('pet')
|
|
200
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.defaultTo(4))
|
|
201
|
+
* .execute()
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
138
204
|
defaultTo(value: DefaultValueExpression): ColumnDefinitionBuilder;
|
|
205
|
+
/**
|
|
206
|
+
* Adds a check constraint for the column.
|
|
207
|
+
*
|
|
208
|
+
* ### Examples
|
|
209
|
+
*
|
|
210
|
+
* ```ts
|
|
211
|
+
* db.schema
|
|
212
|
+
* .createTable('pet')
|
|
213
|
+
* .addColumn('number_of_legs', 'integer', (col) => col.check('number_of_legs < 5'))
|
|
214
|
+
* .execute()
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
139
217
|
check(sql: string): ColumnDefinitionBuilder;
|
|
218
|
+
/**
|
|
219
|
+
* Makes the column a generated column using a `generated always as` statement.
|
|
220
|
+
*
|
|
221
|
+
* ### Examples
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* db.schema
|
|
225
|
+
* .createTable('person')
|
|
226
|
+
* .addColumn('full_name', 'varchar(255)',
|
|
227
|
+
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
228
|
+
* )
|
|
229
|
+
* .execute()
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
140
232
|
generatedAlwaysAs(sql: string): ColumnDefinitionBuilder;
|
|
233
|
+
/**
|
|
234
|
+
* Makes a generated column stored instead of virtual. This method can only
|
|
235
|
+
* be used with {@link generatedAlwaysAs}
|
|
236
|
+
*
|
|
237
|
+
* ### Examples
|
|
238
|
+
*
|
|
239
|
+
* ```ts
|
|
240
|
+
* db.schema
|
|
241
|
+
* .createTable('person')
|
|
242
|
+
* .addColumn('full_name', 'varchar(255)', (col) => col
|
|
243
|
+
* .generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
244
|
+
* .stored()
|
|
245
|
+
* )
|
|
246
|
+
* .execute()
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
141
249
|
stored(): ColumnDefinitionBuilder;
|
|
142
250
|
toOperationNode(): ColumnDefinitionNode;
|
|
143
251
|
}
|
|
@@ -7,8 +7,44 @@ import { DialectAdapter } from './dialect-adapter.js';
|
|
|
7
7
|
* they are added and there will be less breaking changes.
|
|
8
8
|
*/
|
|
9
9
|
export declare abstract class DialectAdapterBase implements DialectAdapter {
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not this dialect supports transactional DDL.
|
|
12
|
+
*
|
|
13
|
+
* If this is true, migrations are executed inside a transaction.
|
|
14
|
+
*/
|
|
10
15
|
get supportsTransactionalDdl(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether or not this dialect supports the `returning` in inserts
|
|
18
|
+
* updates and deletes.
|
|
19
|
+
*/
|
|
11
20
|
get supportsReturning(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* This method is used to acquire a lock for the migrations so that
|
|
23
|
+
* it's not possible for two migration processes to run in parallel.
|
|
24
|
+
*
|
|
25
|
+
* Most dialects have explicit locks that can be used, like advisory locks
|
|
26
|
+
* in PostgreSQL and the get_lock function in MySQL.
|
|
27
|
+
*
|
|
28
|
+
* If the dialect doesn't have explicit locks the {@link MIGRATION_LOCK_TABLE}
|
|
29
|
+
* created by Kysely can be used instead. {@link MIGRATION_LOCK_TABLE}
|
|
30
|
+
* has two columns `id` and `is_locked` and there's only one row in the
|
|
31
|
+
* table whose id is {@link MIGRATION_LOCK_ID}. `is_locked` is an integer.
|
|
32
|
+
* Kysely takes care of creating the lock table and inserting the one single
|
|
33
|
+
* row to it before this method is executed.
|
|
34
|
+
*
|
|
35
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
36
|
+
* is a transaction inside which the migrations will be executed. Otherwise
|
|
37
|
+
* `db` is a single connection (session) that will be used to execute the
|
|
38
|
+
* migrations.
|
|
39
|
+
*/
|
|
12
40
|
abstract acquireMigrationLock(db: Kysely<any>): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Releases the migration lock. See {@link acquireMigrationLock}.
|
|
43
|
+
*
|
|
44
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
45
|
+
* is a transaction inside which the migrations were executed. Otherwise `db`
|
|
46
|
+
* is a single connection (session) that was used to execute the migrations
|
|
47
|
+
* and the `acquireMigrationLock` call.
|
|
48
|
+
*/
|
|
13
49
|
abstract releaseMigrationLock(db: Kysely<any>): Promise<void>;
|
|
14
50
|
}
|
|
@@ -1,8 +1,44 @@
|
|
|
1
1
|
import { Kysely } from '../../kysely.js';
|
|
2
2
|
import { DialectAdapter } from '../dialect-adapter.js';
|
|
3
3
|
export declare class MysqlAdapter implements DialectAdapter {
|
|
4
|
+
/**
|
|
5
|
+
* Whether or not this dialect supports transactional DDL.
|
|
6
|
+
*
|
|
7
|
+
* If this is true, migrations are executed inside a transaction.
|
|
8
|
+
*/
|
|
4
9
|
get supportsTransactionalDdl(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not this dialect supports the `returning` in inserts
|
|
12
|
+
* updates and deletes.
|
|
13
|
+
*/
|
|
5
14
|
get supportsReturning(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* This method is used to acquire a lock for the migrations so that
|
|
17
|
+
* it's not possible for two migration processes to run in parallel.
|
|
18
|
+
*
|
|
19
|
+
* Most dialects have explicit locks that can be used, like advisory locks
|
|
20
|
+
* in PostgreSQL and the get_lock function in MySQL.
|
|
21
|
+
*
|
|
22
|
+
* If the dialect doesn't have explicit locks the {@link MIGRATION_LOCK_TABLE}
|
|
23
|
+
* created by Kysely can be used instead. {@link MIGRATION_LOCK_TABLE}
|
|
24
|
+
* has two columns `id` and `is_locked` and there's only one row in the
|
|
25
|
+
* table whose id is {@link MIGRATION_LOCK_ID}. `is_locked` is an integer.
|
|
26
|
+
* Kysely takes care of creating the lock table and inserting the one single
|
|
27
|
+
* row to it before this method is executed.
|
|
28
|
+
*
|
|
29
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
30
|
+
* is a transaction inside which the migrations will be executed. Otherwise
|
|
31
|
+
* `db` is a single connection (session) that will be used to execute the
|
|
32
|
+
* migrations.
|
|
33
|
+
*/
|
|
6
34
|
acquireMigrationLock(db: Kysely<any>): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Releases the migration lock. See {@link acquireMigrationLock}.
|
|
37
|
+
*
|
|
38
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
39
|
+
* is a transaction inside which the migrations were executed. Otherwise `db`
|
|
40
|
+
* is a single connection (session) that was used to execute the migrations
|
|
41
|
+
* and the `acquireMigrationLock` call.
|
|
42
|
+
*/
|
|
7
43
|
releaseMigrationLock(db: Kysely<any>): Promise<void>;
|
|
8
44
|
}
|
|
@@ -15,9 +15,25 @@ import { DatabaseConnection } from '../../driver/database-connection.js';
|
|
|
15
15
|
export declare class MysqlDialect implements Dialect {
|
|
16
16
|
#private;
|
|
17
17
|
constructor(config: MysqlDialectConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Creates a driver for the dialect.
|
|
20
|
+
*/
|
|
18
21
|
createDriver(): Driver;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a query compiler for the dialect.
|
|
24
|
+
*/
|
|
19
25
|
createQueryCompiler(): QueryCompiler;
|
|
26
|
+
/**
|
|
27
|
+
* Creates an adapter for the dialect.
|
|
28
|
+
*/
|
|
20
29
|
createAdapter(): DialectAdapter;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a database introspector that can be used to get the database metadata
|
|
32
|
+
* such as the tables and columns that exist in the database.
|
|
33
|
+
*
|
|
34
|
+
* `db` never has any plugins installed. It's created using
|
|
35
|
+
* {@link Kysely.withoutPlugins}.
|
|
36
|
+
*/
|
|
21
37
|
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
|
|
22
38
|
}
|
|
23
39
|
/**
|
|
@@ -4,11 +4,40 @@ import { MysqlDialectConfig } from './mysql-dialect.js';
|
|
|
4
4
|
export declare class MysqlDriver implements Driver {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(config: MysqlDialectConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Initializes the driver.
|
|
9
|
+
*
|
|
10
|
+
* After calling this method the driver should be usable and `acquireConnection` etc.
|
|
11
|
+
* methods should be callable.
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: The underlying database engine driver (like [pg](https://node-postgres.com/))
|
|
14
|
+
* should be imported inside this function, not at the top of the driver file! This is
|
|
15
|
+
* important so that Kysely is usable without installing all database driver libraries
|
|
16
|
+
* it supports.
|
|
17
|
+
*/
|
|
7
18
|
init(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Acquires a new connection from the pool.
|
|
21
|
+
*/
|
|
8
22
|
acquireConnection(): Promise<DatabaseConnection>;
|
|
23
|
+
/**
|
|
24
|
+
* Begins a transaction.
|
|
25
|
+
*/
|
|
9
26
|
beginTransaction(connection: DatabaseConnection, settings: TransactionSettings): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Commits a transaction.
|
|
29
|
+
*/
|
|
10
30
|
commitTransaction(connection: DatabaseConnection): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Rolls back a transaction.
|
|
33
|
+
*/
|
|
11
34
|
rollbackTransaction(connection: DatabaseConnection): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Releases a connection back to the pool.
|
|
37
|
+
*/
|
|
12
38
|
releaseConnection(connection: DatabaseConnection): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Destroys the driver and releases all resources.
|
|
41
|
+
*/
|
|
13
42
|
destroy(): Promise<void>;
|
|
14
43
|
}
|
|
@@ -3,5 +3,8 @@ import { Kysely } from '../../kysely.js';
|
|
|
3
3
|
export declare class MysqlIntrospector implements DatabaseIntrospector {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(db: Kysely<any>);
|
|
6
|
+
/**
|
|
7
|
+
* Get the database metadata such as the names of the tables and columns.
|
|
8
|
+
*/
|
|
6
9
|
getMetadata(options?: DatabaseMetadataOptions): Promise<DatabaseMetadata>;
|
|
7
10
|
}
|
|
@@ -1,8 +1,44 @@
|
|
|
1
1
|
import { Kysely } from '../../kysely.js';
|
|
2
2
|
import { DialectAdapter } from '../dialect-adapter.js';
|
|
3
3
|
export declare class PostgresAdapter implements DialectAdapter {
|
|
4
|
+
/**
|
|
5
|
+
* Whether or not this dialect supports transactional DDL.
|
|
6
|
+
*
|
|
7
|
+
* If this is true, migrations are executed inside a transaction.
|
|
8
|
+
*/
|
|
4
9
|
get supportsTransactionalDdl(): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not this dialect supports the `returning` in inserts
|
|
12
|
+
* updates and deletes.
|
|
13
|
+
*/
|
|
5
14
|
get supportsReturning(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* This method is used to acquire a lock for the migrations so that
|
|
17
|
+
* it's not possible for two migration processes to run in parallel.
|
|
18
|
+
*
|
|
19
|
+
* Most dialects have explicit locks that can be used, like advisory locks
|
|
20
|
+
* in PostgreSQL and the get_lock function in MySQL.
|
|
21
|
+
*
|
|
22
|
+
* If the dialect doesn't have explicit locks the {@link MIGRATION_LOCK_TABLE}
|
|
23
|
+
* created by Kysely can be used instead. {@link MIGRATION_LOCK_TABLE}
|
|
24
|
+
* has two columns `id` and `is_locked` and there's only one row in the
|
|
25
|
+
* table whose id is {@link MIGRATION_LOCK_ID}. `is_locked` is an integer.
|
|
26
|
+
* Kysely takes care of creating the lock table and inserting the one single
|
|
27
|
+
* row to it before this method is executed.
|
|
28
|
+
*
|
|
29
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
30
|
+
* is a transaction inside which the migrations will be executed. Otherwise
|
|
31
|
+
* `db` is a single connection (session) that will be used to execute the
|
|
32
|
+
* migrations.
|
|
33
|
+
*/
|
|
6
34
|
acquireMigrationLock(db: Kysely<any>): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Releases the migration lock. See {@link acquireMigrationLock}.
|
|
37
|
+
*
|
|
38
|
+
* If `supportsTransactionalDdl` is `true` then the `db` passed to this method
|
|
39
|
+
* is a transaction inside which the migrations were executed. Otherwise `db`
|
|
40
|
+
* is a single connection (session) that was used to execute the migrations
|
|
41
|
+
* and the `acquireMigrationLock` call.
|
|
42
|
+
*/
|
|
7
43
|
releaseMigrationLock(): Promise<void>;
|
|
8
44
|
}
|
|
@@ -21,9 +21,25 @@ import { DatabaseConnection } from '../../driver/database-connection.js';
|
|
|
21
21
|
export declare class PostgresDialect implements Dialect {
|
|
22
22
|
#private;
|
|
23
23
|
constructor(config: PostgresDialectConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Creates a driver for the dialect.
|
|
26
|
+
*/
|
|
24
27
|
createDriver(): Driver;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a query compiler for the dialect.
|
|
30
|
+
*/
|
|
25
31
|
createQueryCompiler(): QueryCompiler;
|
|
32
|
+
/**
|
|
33
|
+
* Creates an adapter for the dialect.
|
|
34
|
+
*/
|
|
26
35
|
createAdapter(): DialectAdapter;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a database introspector that can be used to get the database metadata
|
|
38
|
+
* such as the tables and columns that exist in the database.
|
|
39
|
+
*
|
|
40
|
+
* `db` never has any plugins installed. It's created using
|
|
41
|
+
* {@link Kysely.withoutPlugins}.
|
|
42
|
+
*/
|
|
27
43
|
createIntrospector(db: Kysely<any>): DatabaseIntrospector;
|
|
28
44
|
}
|
|
29
45
|
/**
|
|
@@ -4,11 +4,40 @@ import { PostgresDialectConfig } from './postgres-dialect.js';
|
|
|
4
4
|
export declare class PostgresDriver implements Driver {
|
|
5
5
|
#private;
|
|
6
6
|
constructor(config: PostgresDialectConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Initializes the driver.
|
|
9
|
+
*
|
|
10
|
+
* After calling this method the driver should be usable and `acquireConnection` etc.
|
|
11
|
+
* methods should be callable.
|
|
12
|
+
*
|
|
13
|
+
* IMPORTANT: The underlying database engine driver (like [pg](https://node-postgres.com/))
|
|
14
|
+
* should be imported inside this function, not at the top of the driver file! This is
|
|
15
|
+
* important so that Kysely is usable without installing all database driver libraries
|
|
16
|
+
* it supports.
|
|
17
|
+
*/
|
|
7
18
|
init(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Acquires a new connection from the pool.
|
|
21
|
+
*/
|
|
8
22
|
acquireConnection(): Promise<DatabaseConnection>;
|
|
23
|
+
/**
|
|
24
|
+
* Begins a transaction.
|
|
25
|
+
*/
|
|
9
26
|
beginTransaction(connection: DatabaseConnection, settings: TransactionSettings): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Commits a transaction.
|
|
29
|
+
*/
|
|
10
30
|
commitTransaction(connection: DatabaseConnection): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Rolls back a transaction.
|
|
33
|
+
*/
|
|
11
34
|
rollbackTransaction(connection: DatabaseConnection): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Releases a connection back to the pool.
|
|
37
|
+
*/
|
|
12
38
|
releaseConnection(connection: DatabaseConnection): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Destroys the driver and releases all resources.
|
|
41
|
+
*/
|
|
13
42
|
destroy(): Promise<void>;
|
|
14
43
|
}
|
|
@@ -3,5 +3,8 @@ import { Kysely } from '../../kysely.js';
|
|
|
3
3
|
export declare class PostgresIntrospector implements DatabaseIntrospector {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(db: Kysely<any>);
|
|
6
|
+
/**
|
|
7
|
+
* Get the database metadata such as the names of the tables and columns.
|
|
8
|
+
*/
|
|
6
9
|
getMetadata(options?: DatabaseMetadataOptions): Promise<DatabaseMetadata>;
|
|
7
10
|
}
|