@simplysm/orm-common 14.0.22 → 14.0.24
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/package.json +3 -4
- package/README.md +0 -170
- package/docs/core.md +0 -217
- package/docs/expression.md +0 -220
- package/docs/query-builder.md +0 -150
- package/docs/queryable.md +0 -261
- package/docs/schema-builders.md +0 -288
- package/docs/types.md +0 -481
package/docs/types.md
DELETED
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
# Types
|
|
2
|
-
|
|
3
|
-
Core type definitions for the ORM.
|
|
4
|
-
|
|
5
|
-
## Database Types
|
|
6
|
-
|
|
7
|
-
### Dialect
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
type Dialect = "mysql" | "mssql" | "postgresql";
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Supported database dialects. MySQL 8.0.14+, MSSQL 2012+, PostgreSQL 9.0+.
|
|
14
|
-
|
|
15
|
-
### dialects
|
|
16
|
-
|
|
17
|
-
```typescript
|
|
18
|
-
const dialects: Dialect[] = ["mysql", "mssql", "postgresql"];
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Array of all supported dialects. Useful for parameterized tests.
|
|
22
|
-
|
|
23
|
-
### IsolationLevel
|
|
24
|
-
|
|
25
|
-
```typescript
|
|
26
|
-
type IsolationLevel = "READ_UNCOMMITTED" | "READ_COMMITTED" | "REPEATABLE_READ" | "SERIALIZABLE";
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### DataRecord
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
type DataRecord = {
|
|
33
|
-
[key: string]: ColumnPrimitive | DataRecord | DataRecord[];
|
|
34
|
-
};
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Recursive query result type. Supports nested relations via include/join.
|
|
38
|
-
|
|
39
|
-
### DbContextExecutor
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
interface DbContextExecutor {
|
|
43
|
-
connect(): Promise<void>;
|
|
44
|
-
close(): Promise<void>;
|
|
45
|
-
beginTransaction(isolationLevel?: IsolationLevel): Promise<void>;
|
|
46
|
-
commitTransaction(): Promise<void>;
|
|
47
|
-
rollbackTransaction(): Promise<void>;
|
|
48
|
-
executeDefs<T = DataRecord>(
|
|
49
|
-
defs: QueryDef[],
|
|
50
|
-
resultMetas?: (ResultMeta | undefined)[],
|
|
51
|
-
): Promise<T[][]>;
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Query execution interface. Implemented by `NodeDbContextExecutor` (server) or service client executors.
|
|
56
|
-
|
|
57
|
-
### ResultMeta
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
interface ResultMeta {
|
|
61
|
-
columns: Record<string, ColumnPrimitiveStr>;
|
|
62
|
-
joins: Record<string, { isSingle: boolean }>;
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
| Field | Type | Description |
|
|
67
|
-
|-------|------|-------------|
|
|
68
|
-
| `columns` | `Record<string, ColumnPrimitiveStr>` | Column name to type name mapping |
|
|
69
|
-
| `joins` | `Record<string, { isSingle: boolean }>` | JOIN alias to single/array flag |
|
|
70
|
-
|
|
71
|
-
### Migration
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
interface Migration {
|
|
75
|
-
name: string;
|
|
76
|
-
up: (db: DbContextBase & DbContextDdlMethods) => Promise<void>;
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
| Field | Type | Description |
|
|
81
|
-
|-------|------|-------------|
|
|
82
|
-
| `name` | `string` | Unique migration name (timestamp recommended) |
|
|
83
|
-
| `up` | `(db) => Promise<void>` | Migration execution function |
|
|
84
|
-
|
|
85
|
-
### QueryBuildResult
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
interface QueryBuildResult {
|
|
89
|
-
sql: string;
|
|
90
|
-
resultSetIndex?: number;
|
|
91
|
-
resultSetStride?: number;
|
|
92
|
-
}
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
| Field | Type | Description |
|
|
96
|
-
|-------|------|-------------|
|
|
97
|
-
| `sql` | `string` | Generated SQL string |
|
|
98
|
-
| `resultSetIndex` | `number?` | Index of result set to use |
|
|
99
|
-
| `resultSetStride` | `number?` | Extract every Nth result set |
|
|
100
|
-
|
|
101
|
-
## DbContext Types
|
|
102
|
-
|
|
103
|
-
See [Core documentation](./core.md) for detailed descriptions of these types.
|
|
104
|
-
|
|
105
|
-
### DbContextBase
|
|
106
|
-
|
|
107
|
-
```typescript
|
|
108
|
-
interface DbContextBase {
|
|
109
|
-
status: DbContextStatus;
|
|
110
|
-
readonly database: string | undefined;
|
|
111
|
-
readonly schema: string | undefined;
|
|
112
|
-
getNextAlias(): string;
|
|
113
|
-
resetAliasCounter(): void;
|
|
114
|
-
executeDefs<T = DataRecord>(defs: QueryDef[], resultMetas?: (ResultMeta | undefined)[]): Promise<T[][]>;
|
|
115
|
-
getQueryDefObjectName(tableOrView: TableBuilder | ViewBuilder): QueryDefObjectName;
|
|
116
|
-
switchFk(table: QueryDefObjectName, enabled: boolean): Promise<void>;
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Core interface implemented by DbContext. Used internally by Queryable, Executable, and ViewBuilder.
|
|
121
|
-
|
|
122
|
-
### DbContextStatus
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
type DbContextStatus = "ready" | "connect" | "transact";
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
### DbContextDdlMethods
|
|
129
|
-
|
|
130
|
-
See [Core - DDL Execution Methods](./core.md#ddl-execution-methods) and [Core - DDL QueryDef Generators](./core.md#ddl-querydef-generators) for the full list of 18 DDL execution methods and 22 QueryDef generator methods.
|
|
131
|
-
|
|
132
|
-
## Column Types
|
|
133
|
-
|
|
134
|
-
### DataType
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
type DataType =
|
|
138
|
-
| { type: "int" }
|
|
139
|
-
| { type: "bigint" }
|
|
140
|
-
| { type: "float" }
|
|
141
|
-
| { type: "double" }
|
|
142
|
-
| { type: "decimal"; precision: number; scale?: number }
|
|
143
|
-
| { type: "varchar"; length: number }
|
|
144
|
-
| { type: "char"; length: number }
|
|
145
|
-
| { type: "text" }
|
|
146
|
-
| { type: "binary" }
|
|
147
|
-
| { type: "boolean" }
|
|
148
|
-
| { type: "datetime" }
|
|
149
|
-
| { type: "date" }
|
|
150
|
-
| { type: "time" }
|
|
151
|
-
| { type: "uuid" };
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
SQL data type definition. Used in ColumnBuilder metadata, CAST expressions, and DDL generation.
|
|
155
|
-
|
|
156
|
-
### ColumnPrimitive
|
|
157
|
-
|
|
158
|
-
```typescript
|
|
159
|
-
type ColumnPrimitive = string | number | boolean | DateTime | DateOnly | Time | Uuid | Bytes | undefined;
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
All storable column primitive types. `undefined` represents SQL NULL.
|
|
163
|
-
|
|
164
|
-
### ColumnPrimitiveStr
|
|
165
|
-
|
|
166
|
-
```typescript
|
|
167
|
-
type ColumnPrimitiveStr = "string" | "number" | "boolean" | "DateTime" | "DateOnly" | "Time" | "Uuid" | "Bytes";
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### ColumnPrimitiveMap
|
|
171
|
-
|
|
172
|
-
```typescript
|
|
173
|
-
type ColumnPrimitiveMap = {
|
|
174
|
-
string: string;
|
|
175
|
-
number: number;
|
|
176
|
-
boolean: boolean;
|
|
177
|
-
DateTime: DateTime;
|
|
178
|
-
DateOnly: DateOnly;
|
|
179
|
-
Time: Time;
|
|
180
|
-
Uuid: Uuid;
|
|
181
|
-
Bytes: Bytes;
|
|
182
|
-
};
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### ColumnMeta
|
|
186
|
-
|
|
187
|
-
```typescript
|
|
188
|
-
interface ColumnMeta {
|
|
189
|
-
type: ColumnPrimitiveStr;
|
|
190
|
-
dataType: DataType;
|
|
191
|
-
autoIncrement?: boolean;
|
|
192
|
-
nullable?: boolean;
|
|
193
|
-
default?: ColumnPrimitive;
|
|
194
|
-
description?: string;
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### dataTypeStrToColumnPrimitiveStr
|
|
199
|
-
|
|
200
|
-
```typescript
|
|
201
|
-
const dataTypeStrToColumnPrimitiveStr: Record<DataType["type"], ColumnPrimitiveStr>
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Maps SQL type names to TypeScript type names. For example: `"int"` -> `"number"`, `"datetime"` -> `"DateTime"`, `"varchar"` -> `"string"`.
|
|
205
|
-
|
|
206
|
-
### InferColumnPrimitiveFromDataType
|
|
207
|
-
|
|
208
|
-
```typescript
|
|
209
|
-
type InferColumnPrimitiveFromDataType<TDataType extends DataType> = ColumnPrimitiveMap[...]
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
Infers the TypeScript type from a DataType definition.
|
|
213
|
-
|
|
214
|
-
### inferColumnPrimitiveStr
|
|
215
|
-
|
|
216
|
-
```typescript
|
|
217
|
-
function inferColumnPrimitiveStr(value: ColumnPrimitive): ColumnPrimitiveStr
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Infers the ColumnPrimitiveStr from a runtime value. Throws for unknown types.
|
|
221
|
-
|
|
222
|
-
## Column Builder Types
|
|
223
|
-
|
|
224
|
-
### ColumnBuilderRecord
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
type ColumnBuilderRecord = Record<string, ColumnBuilder<ColumnPrimitive, ColumnMeta>>;
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### InferColumns
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
type InferColumns<TBuilders extends ColumnBuilderRecord> = {
|
|
234
|
-
[K in keyof TBuilders]: TBuilders[K] extends ColumnBuilder<infer V, any> ? V : never;
|
|
235
|
-
};
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
Extracts runtime value types from a column builder record.
|
|
239
|
-
|
|
240
|
-
### InferColumnExprs
|
|
241
|
-
|
|
242
|
-
```typescript
|
|
243
|
-
type InferColumnExprs<TBuilders extends ColumnBuilderRecord> = {
|
|
244
|
-
[K in keyof TBuilders]: TBuilders[K] extends ColumnBuilder<infer V, any> ? ExprInput<V> : never;
|
|
245
|
-
};
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### InferInsertColumns
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
type InferInsertColumns<TBuilders> = Pick<InferColumns<TBuilders>, RequiredInsertKeys<TBuilders>> &
|
|
252
|
-
Partial<Pick<InferColumns<TBuilders>, OptionalInsertKeys<TBuilders>>>;
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
INSERT type: required columns are required, autoIncrement/nullable/default columns are optional.
|
|
256
|
-
|
|
257
|
-
### InferUpdateColumns
|
|
258
|
-
|
|
259
|
-
```typescript
|
|
260
|
-
type InferUpdateColumns<TBuilders> = Partial<InferColumns<TBuilders>>;
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
UPDATE type: all columns are optional.
|
|
264
|
-
|
|
265
|
-
### RequiredInsertKeys
|
|
266
|
-
|
|
267
|
-
```typescript
|
|
268
|
-
type RequiredInsertKeys<TBuilders> = /* columns without autoIncrement, nullable, or default */
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### OptionalInsertKeys
|
|
272
|
-
|
|
273
|
-
```typescript
|
|
274
|
-
type OptionalInsertKeys<TBuilders> = Exclude<keyof TBuilders, RequiredInsertKeys<TBuilders>>;
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
### DataToColumnBuilderRecord
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
type DataToColumnBuilderRecord<TData extends DataRecord> = {
|
|
281
|
-
[K in keyof TData as TData[K] extends ColumnPrimitive ? K : never]: ColumnBuilder<TData[K], any>;
|
|
282
|
-
};
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
## Relation Types
|
|
286
|
-
|
|
287
|
-
### RelationBuilderRecord
|
|
288
|
-
|
|
289
|
-
```typescript
|
|
290
|
-
type RelationBuilderRecord = Record<string,
|
|
291
|
-
ForeignKeyBuilder<any, any> | ForeignKeyTargetBuilder<any, any> |
|
|
292
|
-
RelationKeyBuilder<any, any> | RelationKeyTargetBuilder<any, any>>;
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
### InferDeepRelations
|
|
296
|
-
|
|
297
|
-
```typescript
|
|
298
|
-
type InferDeepRelations<TRelations extends RelationBuilderRecord> = {
|
|
299
|
-
[K in keyof TRelations]?: ExtractRelationTarget<TRelations[K]> | ExtractRelationTargetResult<TRelations[K]>;
|
|
300
|
-
};
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
All relations are optional (loaded only via `include()`).
|
|
304
|
-
|
|
305
|
-
### ExtractRelationTarget
|
|
306
|
-
|
|
307
|
-
```typescript
|
|
308
|
-
type ExtractRelationTarget<TRelation> = /* Extracts N:1 target type (single object) */
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
For FK/RelationKey relations, extracts `InferColumns<TCols> & InferDeepRelations<TRels>` of the target table.
|
|
312
|
-
|
|
313
|
-
### ExtractRelationTargetResult
|
|
314
|
-
|
|
315
|
-
```typescript
|
|
316
|
-
type ExtractRelationTargetResult<TRelation> = /* Extracts 1:N target type (array or single) */
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
For FKTarget/RelationKeyTarget relations, extracts an array type (or single object if `isSingle: true`).
|
|
320
|
-
|
|
321
|
-
## Expression Types
|
|
322
|
-
|
|
323
|
-
### DateUnit
|
|
324
|
-
|
|
325
|
-
```typescript
|
|
326
|
-
type DateUnit = "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
### WhereExpr
|
|
330
|
-
|
|
331
|
-
```typescript
|
|
332
|
-
type WhereExpr =
|
|
333
|
-
| ExprEq | ExprGt | ExprLt | ExprGte | ExprLte | ExprBetween
|
|
334
|
-
| ExprIsNull | ExprLike | ExprRegexp
|
|
335
|
-
| ExprIn | ExprInQuery | ExprExists
|
|
336
|
-
| ExprNot | ExprAnd | ExprOr;
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
Union of all WHERE-clause expression types (comparison + logical).
|
|
340
|
-
|
|
341
|
-
### Expr
|
|
342
|
-
|
|
343
|
-
```typescript
|
|
344
|
-
type Expr =
|
|
345
|
-
| ExprColumn | ExprValue | ExprRaw
|
|
346
|
-
| ExprConcat | ExprLeft | ExprRight | ExprTrim | ExprPadStart | ExprReplace
|
|
347
|
-
| ExprUpper | ExprLower | ExprLength | ExprByteLength | ExprSubstring | ExprIndexOf
|
|
348
|
-
| ExprAbs | ExprRound | ExprCeil | ExprFloor
|
|
349
|
-
| ExprYear | ExprMonth | ExprDay | ExprHour | ExprMinute | ExprSecond
|
|
350
|
-
| ExprIsoWeek | ExprIsoWeekStartDate | ExprIsoYearMonth
|
|
351
|
-
| ExprDateDiff | ExprDateAdd | ExprFormatDate
|
|
352
|
-
| ExprCoalesce | ExprNullIf | ExprIs | ExprSwitch | ExprIf
|
|
353
|
-
| ExprCount | ExprSum | ExprAvg | ExprMax | ExprMin
|
|
354
|
-
| ExprGreatest | ExprLeast | ExprRowNum | ExprRandom | ExprCast
|
|
355
|
-
| ExprWindow | ExprSubquery;
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
Union of all expression types (value, string, number, date, conditional, aggregate, window, system).
|
|
359
|
-
|
|
360
|
-
### WinFn
|
|
361
|
-
|
|
362
|
-
```typescript
|
|
363
|
-
type WinFn =
|
|
364
|
-
| WinFnRowNumber | WinFnRank | WinFnDenseRank | WinFnNtile
|
|
365
|
-
| WinFnLag | WinFnLead | WinFnFirstValue | WinFnLastValue
|
|
366
|
-
| WinFnSum | WinFnAvg | WinFnCount | WinFnMin | WinFnMax;
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### WinSpec
|
|
370
|
-
|
|
371
|
-
```typescript
|
|
372
|
-
interface WinSpec {
|
|
373
|
-
partitionBy?: Expr[];
|
|
374
|
-
orderBy?: [Expr, ("ASC" | "DESC")?][];
|
|
375
|
-
}
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
## QueryDef Types
|
|
379
|
-
|
|
380
|
-
### QueryDefObjectName
|
|
381
|
-
|
|
382
|
-
```typescript
|
|
383
|
-
interface QueryDefObjectName {
|
|
384
|
-
database?: string;
|
|
385
|
-
schema?: string;
|
|
386
|
-
name: string;
|
|
387
|
-
}
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
DB object name. MySQL: `database.name`, MSSQL: `database.schema.name`, PostgreSQL: `schema.name`.
|
|
391
|
-
|
|
392
|
-
### QueryDef
|
|
393
|
-
|
|
394
|
-
```typescript
|
|
395
|
-
type QueryDef =
|
|
396
|
-
// DML
|
|
397
|
-
| SelectQueryDef | InsertQueryDef | InsertIfNotExistsQueryDef | InsertIntoQueryDef
|
|
398
|
-
| UpdateQueryDef | DeleteQueryDef | UpsertQueryDef
|
|
399
|
-
// DDL
|
|
400
|
-
| ClearSchemaQueryDef | CreateTableQueryDef | DropTableQueryDef | RenameTableQueryDef
|
|
401
|
-
| TruncateQueryDef | AddColumnQueryDef | DropColumnQueryDef | ModifyColumnQueryDef
|
|
402
|
-
| RenameColumnQueryDef | DropPrimaryKeyQueryDef | AddPrimaryKeyQueryDef
|
|
403
|
-
| AddForeignKeyQueryDef | DropForeignKeyQueryDef | AddIndexQueryDef | DropIndexQueryDef
|
|
404
|
-
| CreateViewQueryDef | DropViewQueryDef | CreateProcQueryDef | DropProcQueryDef
|
|
405
|
-
// Utils/Meta
|
|
406
|
-
| ExecProcQueryDef | SwitchFkQueryDef | SchemaExistsQueryDef;
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### DDL_TYPES
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
const DDL_TYPES: readonly DdlType[]
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
Array of all DDL query type strings. Used for blocking DDL inside transactions.
|
|
416
|
-
|
|
417
|
-
### DdlType
|
|
418
|
-
|
|
419
|
-
```typescript
|
|
420
|
-
type DdlType = "clearSchema" | "createTable" | "dropTable" | "renameTable" | "truncate"
|
|
421
|
-
| "addColumn" | "dropColumn" | "modifyColumn" | "renameColumn"
|
|
422
|
-
| "dropPrimaryKey" | "addPrimaryKey" | "addForeignKey" | "dropForeignKey"
|
|
423
|
-
| "addIndex" | "dropIndex" | "createView" | "dropView" | "createProc" | "dropProc";
|
|
424
|
-
```
|
|
425
|
-
|
|
426
|
-
### DML QueryDef Interfaces
|
|
427
|
-
|
|
428
|
-
| Interface | type field | Key fields |
|
|
429
|
-
|-----------|-----------|-------------|
|
|
430
|
-
| `SelectQueryDef` | `"select"` | `from`, `as`, `select`, `distinct`, `top`, `lock`, `where`, `joins`, `orderBy`, `limit`, `groupBy`, `having`, `with` |
|
|
431
|
-
| `SelectQueryDefJoin` | `"select"` | Extends SelectQueryDef + `isSingle` |
|
|
432
|
-
| `InsertQueryDef` | `"insert"` | `table`, `records`, `overrideIdentity`, `output` |
|
|
433
|
-
| `InsertIfNotExistsQueryDef` | `"insertIfNotExists"` | `table`, `record`, `existsSelectQuery`, `output` |
|
|
434
|
-
| `InsertIntoQueryDef` | `"insertInto"` | `table`, `recordsSelectQuery`, `output` |
|
|
435
|
-
| `UpdateQueryDef` | `"update"` | `table`, `as`, `record`, `top`, `where`, `joins`, `limit`, `output` |
|
|
436
|
-
| `DeleteQueryDef` | `"delete"` | `table`, `as`, `top`, `where`, `joins`, `limit`, `output` |
|
|
437
|
-
| `UpsertQueryDef` | `"upsert"` | `table`, `existsSelectQuery`, `insertRecord`, `updateRecord`, `output` |
|
|
438
|
-
| `ExecProcQueryDef` | `"execProc"` | `procedure`, `params` |
|
|
439
|
-
|
|
440
|
-
### DDL QueryDef Interfaces
|
|
441
|
-
|
|
442
|
-
| Interface | type field | Key fields |
|
|
443
|
-
|-----------|-----------|-------------|
|
|
444
|
-
| `ClearSchemaQueryDef` | `"clearSchema"` | `database`, `schema` |
|
|
445
|
-
| `CreateTableQueryDef` | `"createTable"` | `table`, `columns`, `primaryKey` |
|
|
446
|
-
| `DropTableQueryDef` | `"dropTable"` | `table` |
|
|
447
|
-
| `RenameTableQueryDef` | `"renameTable"` | `table`, `newName` |
|
|
448
|
-
| `TruncateQueryDef` | `"truncate"` | `table` |
|
|
449
|
-
| `AddColumnQueryDef` | `"addColumn"` | `table`, `column` |
|
|
450
|
-
| `DropColumnQueryDef` | `"dropColumn"` | `table`, `column` |
|
|
451
|
-
| `ModifyColumnQueryDef` | `"modifyColumn"` | `table`, `column` |
|
|
452
|
-
| `RenameColumnQueryDef` | `"renameColumn"` | `table`, `column`, `newName` |
|
|
453
|
-
| `AddPrimaryKeyQueryDef` | `"addPrimaryKey"` | `table`, `columns` |
|
|
454
|
-
| `DropPrimaryKeyQueryDef` | `"dropPrimaryKey"` | `table` |
|
|
455
|
-
| `AddForeignKeyQueryDef` | `"addForeignKey"` | `table`, `foreignKey` |
|
|
456
|
-
| `DropForeignKeyQueryDef` | `"dropForeignKey"` | `table`, `foreignKey` |
|
|
457
|
-
| `AddIndexQueryDef` | `"addIndex"` | `table`, `index` |
|
|
458
|
-
| `DropIndexQueryDef` | `"dropIndex"` | `table`, `index` |
|
|
459
|
-
| `CreateViewQueryDef` | `"createView"` | `view`, `queryDef` |
|
|
460
|
-
| `DropViewQueryDef` | `"dropView"` | `view` |
|
|
461
|
-
| `CreateProcQueryDef` | `"createProc"` | `procedure`, `params`, `returns`, `query` |
|
|
462
|
-
| `DropProcQueryDef` | `"dropProc"` | `procedure` |
|
|
463
|
-
|
|
464
|
-
### Utility QueryDef Interfaces
|
|
465
|
-
|
|
466
|
-
| Interface | type field | Key fields |
|
|
467
|
-
|-----------|-----------|-------------|
|
|
468
|
-
| `SwitchFkQueryDef` | `"switchFk"` | `table`, `enabled` |
|
|
469
|
-
| `SchemaExistsQueryDef` | `"schemaExists"` | `database`, `schema` |
|
|
470
|
-
|
|
471
|
-
### CudOutputDef
|
|
472
|
-
|
|
473
|
-
```typescript
|
|
474
|
-
interface CudOutputDef {
|
|
475
|
-
columns: string[];
|
|
476
|
-
pkColNames: string[];
|
|
477
|
-
aiColName?: string;
|
|
478
|
-
}
|
|
479
|
-
```
|
|
480
|
-
|
|
481
|
-
OUTPUT clause definition for INSERT/UPDATE/DELETE.
|