knex 0.95.13 → 1.0.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/CHANGELOG.md +74 -3
- package/README.md +1 -1
- package/UPGRADING.md +7 -0
- package/lib/client.js +14 -1
- package/lib/constants.js +2 -0
- package/lib/dialects/better-sqlite3/index.js +72 -0
- package/lib/dialects/cockroachdb/crdb-querycompiler.js +87 -33
- package/lib/dialects/cockroachdb/crdb-tablecompiler.js +19 -0
- package/lib/dialects/cockroachdb/index.js +13 -0
- package/lib/dialects/mssql/index.js +0 -11
- package/lib/dialects/mssql/query/mssql-querycompiler.js +122 -64
- package/lib/dialects/mssql/schema/mssql-columncompiler.js +41 -6
- package/lib/dialects/mssql/schema/mssql-tablecompiler.js +24 -9
- package/lib/dialects/mssql/schema/mssql-viewcompiler.js +15 -1
- package/lib/dialects/mysql/index.js +3 -7
- package/lib/dialects/mysql/query/mysql-querycompiler.js +91 -5
- package/lib/dialects/mysql/schema/mysql-columncompiler.js +32 -5
- package/lib/dialects/mysql/schema/mysql-tablecompiler.js +28 -4
- package/lib/dialects/mysql2/index.js +7 -4
- package/lib/dialects/oracle/query/oracle-querycompiler.js +7 -6
- package/lib/dialects/oracle/schema/internal/trigger.js +1 -1
- package/lib/dialects/oracle/schema/oracle-columncompiler.js +10 -4
- package/lib/dialects/oracle/schema/oracle-tablecompiler.js +17 -6
- package/lib/dialects/oracledb/index.js +0 -4
- package/lib/dialects/oracledb/query/oracledb-querycompiler.js +104 -0
- package/lib/dialects/oracledb/schema/oracledb-columncompiler.js +23 -0
- package/lib/dialects/postgres/index.js +21 -6
- package/lib/dialects/postgres/query/pg-querybuilder.js +8 -0
- package/lib/dialects/postgres/query/pg-querycompiler.js +166 -5
- package/lib/dialects/postgres/schema/pg-columncompiler.js +24 -4
- package/lib/dialects/postgres/schema/pg-tablecompiler.js +55 -47
- package/lib/dialects/redshift/index.js +12 -0
- package/lib/dialects/redshift/query/redshift-querycompiler.js +62 -26
- package/lib/dialects/redshift/schema/redshift-columncompiler.js +2 -1
- package/lib/dialects/redshift/schema/redshift-tablecompiler.js +4 -1
- package/lib/dialects/sqlite3/index.js +18 -4
- package/lib/dialects/sqlite3/query/sqlite-querycompiler.js +85 -18
- package/lib/dialects/sqlite3/schema/ddl.js +274 -282
- package/lib/dialects/sqlite3/schema/internal/sqlite-ddl-operations.js +18 -8
- package/lib/dialects/sqlite3/schema/sqlite-columncompiler.js +20 -0
- package/lib/dialects/sqlite3/schema/sqlite-compiler.js +16 -12
- package/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js +15 -5
- package/lib/dialects/sqlite3/schema/sqlite-viewcompiler.js +31 -2
- package/lib/execution/runner.js +37 -2
- package/lib/knex-builder/FunctionHelper.js +21 -0
- package/lib/migrations/common/MigrationsLoader.js +36 -0
- package/lib/migrations/migrate/MigrationGenerator.js +1 -1
- package/lib/migrations/migrate/Migrator.js +20 -23
- package/lib/migrations/migrate/migration-list-resolver.js +2 -5
- package/lib/migrations/migrate/{configuration-merger.js → migrator-configuration-merger.js} +2 -4
- package/lib/migrations/migrate/sources/fs-migrations.js +4 -29
- package/lib/migrations/migrate/stub/js.stub +8 -1
- package/lib/migrations/migrate/stub/knexfile-js.stub +3 -0
- package/lib/migrations/migrate/stub/knexfile-ts.stub +5 -2
- package/lib/migrations/migrate/table-creator.js +6 -5
- package/lib/migrations/seed/Seeder.js +25 -92
- package/lib/migrations/seed/seeder-configuration-merger.js +60 -0
- package/lib/migrations/seed/sources/fs-seeds.js +65 -0
- package/lib/migrations/seed/stub/js.stub +4 -1
- package/lib/migrations/util/import-file.js +0 -1
- package/lib/query/joinclause.js +24 -5
- package/lib/query/method-constants.js +37 -0
- package/lib/query/querybuilder.js +230 -5
- package/lib/query/querycompiler.js +269 -84
- package/lib/schema/columnbuilder.js +8 -0
- package/lib/schema/columncompiler.js +132 -5
- package/lib/schema/compiler.js +1 -0
- package/lib/schema/tablebuilder.js +41 -8
- package/lib/schema/tablecompiler.js +57 -0
- package/lib/schema/viewcompiler.js +13 -10
- package/package.json +35 -22
- package/scripts/docker-compose.yml +7 -7
- package/scripts/oracledb-install-driver-libs.sh +82 -0
- package/scripts/runkit-example.js +1 -1
- package/scripts/stress-test/docker-compose.yml +3 -3
- package/scripts/stress-test/knex-stress-test.js +1 -1
- package/scripts/stress-test/reconnect-test-mysql-based-drivers.js +1 -1
- package/types/index.d.ts +124 -20
package/types/index.d.ts
CHANGED
|
@@ -328,7 +328,7 @@ interface DMLOptions {
|
|
|
328
328
|
includeTriggerModifications?: boolean;
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
export interface Knex<TRecord extends {} = any, TResult =
|
|
331
|
+
export interface Knex<TRecord extends {} = any, TResult = Record<string, any>[]>
|
|
332
332
|
extends Knex.QueryInterface<TRecord, TResult>, events.EventEmitter {
|
|
333
333
|
<TTable extends Knex.TableNames>(
|
|
334
334
|
tableName: TTable,
|
|
@@ -482,7 +482,7 @@ export declare namespace Knex {
|
|
|
482
482
|
//
|
|
483
483
|
// QueryInterface
|
|
484
484
|
//
|
|
485
|
-
type ClearStatements = "with" | "select" | "columns" | "hintComments" | "where" | "union" | "join" | "group" | "order" | "having" | "limit" | "offset" | "counter" | "counters";
|
|
485
|
+
type ClearStatements = "with" | "select" | "columns" | "hintComments" | "where" | "union" | "using" | "join" | "group" | "order" | "having" | "limit" | "offset" | "counter" | "counters";
|
|
486
486
|
|
|
487
487
|
interface QueryInterface<TRecord extends {} = any, TResult = any> {
|
|
488
488
|
select: Select<TRecord, TResult>;
|
|
@@ -491,6 +491,7 @@ export declare namespace Knex {
|
|
|
491
491
|
column: Select<TRecord, TResult>;
|
|
492
492
|
hintComment: HintComment<TRecord, TResult>;
|
|
493
493
|
from: Table<TRecord, TResult>;
|
|
494
|
+
fromRaw: Table<TRecord, TResult>;
|
|
494
495
|
into: Table<TRecord, TResult>;
|
|
495
496
|
table: Table<TRecord, TResult>;
|
|
496
497
|
distinct: Distinct<TRecord, TResult>;
|
|
@@ -508,6 +509,15 @@ export declare namespace Knex {
|
|
|
508
509
|
fullOuterJoin: Join<TRecord, TResult>;
|
|
509
510
|
crossJoin: Join<TRecord, TResult>;
|
|
510
511
|
|
|
512
|
+
// Json manipulation
|
|
513
|
+
jsonExtract: JsonExtract<TRecord, TResult>;
|
|
514
|
+
jsonSet: JsonSet<TRecord, TResult>;
|
|
515
|
+
jsonInsert: JsonInsert<TRecord, TResult>;
|
|
516
|
+
jsonRemove: JsonRemove<TRecord, TResult>;
|
|
517
|
+
|
|
518
|
+
// Using
|
|
519
|
+
using: Using<TRecord, TResult>;
|
|
520
|
+
|
|
511
521
|
// Withs
|
|
512
522
|
with: With<TRecord, TResult>;
|
|
513
523
|
withRecursive: With<TRecord, TResult>;
|
|
@@ -535,6 +545,8 @@ export declare namespace Knex {
|
|
|
535
545
|
orWhereIn: WhereIn<TRecord, TResult>;
|
|
536
546
|
whereNotIn: WhereIn<TRecord, TResult>;
|
|
537
547
|
orWhereNotIn: WhereIn<TRecord, TResult>;
|
|
548
|
+
whereLike: Where<TRecord, TResult>;
|
|
549
|
+
whereIlike: Where<TRecord, TResult>;
|
|
538
550
|
whereNull: WhereNull<TRecord, TResult>;
|
|
539
551
|
orWhereNull: WhereNull<TRecord, TResult>;
|
|
540
552
|
whereNotNull: WhereNull<TRecord, TResult>;
|
|
@@ -546,6 +558,31 @@ export declare namespace Knex {
|
|
|
546
558
|
orWhereNotBetween: WhereBetween<TRecord, TResult>;
|
|
547
559
|
andWhereNotBetween: WhereBetween<TRecord, TResult>;
|
|
548
560
|
|
|
561
|
+
whereJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
562
|
+
orWhereJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
563
|
+
andWhereJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
564
|
+
whereNotJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
565
|
+
orWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
566
|
+
andWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
|
|
567
|
+
|
|
568
|
+
whereJsonPath: WhereJsonPath<TRecord, TResult>;
|
|
569
|
+
orWhereJsonPath: WhereJsonPath<TRecord, TResult>;
|
|
570
|
+
andWhereJsonPath: WhereJsonPath<TRecord, TResult>;
|
|
571
|
+
|
|
572
|
+
whereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
573
|
+
orWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
574
|
+
andWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
575
|
+
whereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
576
|
+
orWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
577
|
+
andWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
|
|
578
|
+
|
|
579
|
+
whereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
580
|
+
orWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
581
|
+
andWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
582
|
+
whereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
583
|
+
orWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
584
|
+
andWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
|
|
585
|
+
|
|
549
586
|
// Group by
|
|
550
587
|
groupBy: GroupBy<TRecord, TResult>;
|
|
551
588
|
groupByRaw: RawQueryBuilder<TRecord, TResult>;
|
|
@@ -602,8 +639,8 @@ export declare namespace Knex {
|
|
|
602
639
|
clear(statement: ClearStatements): QueryBuilder<TRecord, TResult>;
|
|
603
640
|
|
|
604
641
|
// Paging
|
|
605
|
-
offset(offset: number): QueryBuilder<TRecord, TResult>;
|
|
606
|
-
limit(limit: number): QueryBuilder<TRecord, TResult>;
|
|
642
|
+
offset(offset: number, options?: boolean | Readonly<{skipBinding?: boolean}>): QueryBuilder<TRecord, TResult>;
|
|
643
|
+
limit(limit: number, options?: string | Readonly<{skipBinding?: boolean}>): QueryBuilder<TRecord, TResult>;
|
|
607
644
|
|
|
608
645
|
// Aggregation
|
|
609
646
|
count: AsymmetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>;
|
|
@@ -908,7 +945,7 @@ export declare namespace Knex {
|
|
|
908
945
|
options?: DMLOptions
|
|
909
946
|
): QueryBuilder<TRecord, TResult2>;
|
|
910
947
|
returning<TResult2 = SafePartial<TRecord>[]>(
|
|
911
|
-
column: string | readonly string[],
|
|
948
|
+
column: string | readonly (string | Raw)[] | Raw,
|
|
912
949
|
options?: DMLOptions
|
|
913
950
|
): QueryBuilder<TRecord, TResult2>;
|
|
914
951
|
|
|
@@ -1001,7 +1038,7 @@ export declare namespace Knex {
|
|
|
1001
1038
|
options?: DMLOptions
|
|
1002
1039
|
): QueryBuilder<TRecord, TResult2>;
|
|
1003
1040
|
delete<TResult2 = any>(
|
|
1004
|
-
returning: string | readonly string[],
|
|
1041
|
+
returning: string | readonly (string | Raw)[] | Raw,
|
|
1005
1042
|
options?: DMLOptions
|
|
1006
1043
|
): QueryBuilder<TRecord, TResult2>;
|
|
1007
1044
|
delete<TResult2 = number>(): QueryBuilder<TRecord, TResult2>;
|
|
@@ -1091,6 +1128,30 @@ export declare namespace Knex {
|
|
|
1091
1128
|
): QueryBuilder<TRecord, TResult2>;
|
|
1092
1129
|
}
|
|
1093
1130
|
|
|
1131
|
+
interface JsonExtraction {
|
|
1132
|
+
column: string | Raw | QueryBuilder;
|
|
1133
|
+
path: string;
|
|
1134
|
+
alias?: string;
|
|
1135
|
+
singleValue?: boolean;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
interface JsonExtract<TRecord extends {} = any, TResult extends {} = any> {
|
|
1139
|
+
(column: string | Raw | QueryBuilder, path: string, alias?: string, singleValue?: boolean): QueryBuilder<TRecord, TResult>;
|
|
1140
|
+
(column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder<TRecord, TResult>;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
interface JsonSet<TRecord extends {} = any, TResult extends {} = any> {
|
|
1144
|
+
(column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
interface JsonInsert<TRecord extends {} = any, TResult extends {} = any> {
|
|
1148
|
+
(column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
interface JsonRemove<TRecord extends {} = any, TResult extends {} = any> {
|
|
1152
|
+
(column: string | Raw | QueryBuilder, path: string, alias?: string): QueryBuilder<TRecord, TResult>;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1094
1155
|
interface HintComment<TRecord extends {} = any, TResult extends {} = any> {
|
|
1095
1156
|
(hint: string): QueryBuilder<TRecord, TResult>;
|
|
1096
1157
|
(hints: readonly string[]): QueryBuilder<TRecord, TResult>;
|
|
@@ -1298,12 +1359,12 @@ export declare namespace Knex {
|
|
|
1298
1359
|
andOnVal(column1: string, operator: string, value: Value): JoinClause;
|
|
1299
1360
|
orOnVal(column1: string, value: Value): JoinClause;
|
|
1300
1361
|
orOnVal(column1: string, operator: string, value: Value): JoinClause;
|
|
1301
|
-
onIn(column1: string, values: readonly any[]): JoinClause;
|
|
1302
|
-
andOnIn(column1: string, values: readonly any[]): JoinClause;
|
|
1303
|
-
orOnIn(column1: string, values: readonly any[]): JoinClause;
|
|
1304
|
-
onNotIn(column1: string, values: readonly any[]): JoinClause;
|
|
1305
|
-
andOnNotIn(column1: string, values: readonly any[]): JoinClause;
|
|
1306
|
-
orOnNotIn(column1: string, values: readonly any[]): JoinClause;
|
|
1362
|
+
onIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1363
|
+
andOnIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1364
|
+
orOnIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1365
|
+
onNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1366
|
+
andOnNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1367
|
+
orOnNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
|
|
1307
1368
|
onNull(column1: string): JoinClause;
|
|
1308
1369
|
andOnNull(column1: string): JoinClause;
|
|
1309
1370
|
orOnNull(column1: string): JoinClause;
|
|
@@ -1322,6 +1383,8 @@ export declare namespace Knex {
|
|
|
1322
1383
|
onNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1323
1384
|
andOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1324
1385
|
orOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1386
|
+
onJsonPathEquals(columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string): JoinClause;
|
|
1387
|
+
orOnJsonPathEquals(columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string): JoinClause;
|
|
1325
1388
|
using(
|
|
1326
1389
|
column: string | readonly string[] | Raw | { [key: string]: string | Raw }
|
|
1327
1390
|
): JoinClause;
|
|
@@ -1335,6 +1398,10 @@ export declare namespace Knex {
|
|
|
1335
1398
|
>;
|
|
1336
1399
|
}
|
|
1337
1400
|
|
|
1401
|
+
interface Using<TRecord = any, TResult = unknown[]> {
|
|
1402
|
+
(tables: string[]): QueryBuilder<TRecord, TResult>;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1338
1405
|
interface With<TRecord = any, TResult = unknown[]>
|
|
1339
1406
|
extends WithRaw<TRecord, TResult>,
|
|
1340
1407
|
WithWrapped<TRecord, TResult> {}
|
|
@@ -1453,6 +1520,14 @@ export declare namespace Knex {
|
|
|
1453
1520
|
): QueryBuilder<TRecord, TResult>;
|
|
1454
1521
|
}
|
|
1455
1522
|
|
|
1523
|
+
interface WhereJsonObject<TRecord = any, TResult = unknown[]> {
|
|
1524
|
+
(columnName: keyof TRecord, value: any): QueryBuilder<TRecord, TResult>;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
interface WhereJsonPath<TRecord = any, TResult = unknown[]> {
|
|
1528
|
+
(columnName: keyof TRecord, jsonPath: string, operator: string, value: any): QueryBuilder<TRecord, TResult>;
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1456
1531
|
interface WhereIn<TRecord = any, TResult = unknown[]> {
|
|
1457
1532
|
<K extends keyof ResolveTableType<TRecord>>(
|
|
1458
1533
|
columnName: K,
|
|
@@ -1771,7 +1846,7 @@ export declare namespace Knex {
|
|
|
1771
1846
|
): BatchInsertBuilder<TRecord, TResult2>;
|
|
1772
1847
|
// if data with specific type passed, exclude this method
|
|
1773
1848
|
returning<TResult2 = SafePartial<TRecord>[]>(
|
|
1774
|
-
column: unknown extends TRecord ? string | readonly string[] : never
|
|
1849
|
+
column: unknown extends TRecord ? string | readonly (string | Raw)[] | Raw: never
|
|
1775
1850
|
): BatchInsertBuilder<TRecord, TResult2>;
|
|
1776
1851
|
}
|
|
1777
1852
|
|
|
@@ -1802,7 +1877,8 @@ export declare namespace Knex {
|
|
|
1802
1877
|
and: QueryBuilder<TRecord, TResult>;
|
|
1803
1878
|
|
|
1804
1879
|
// TODO: Promise?
|
|
1805
|
-
columnInfo(column
|
|
1880
|
+
columnInfo(column: keyof DeferredKeySelection.Resolve<TRecord>): Promise<ColumnInfo>;
|
|
1881
|
+
columnInfo(): Promise<Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>>;
|
|
1806
1882
|
|
|
1807
1883
|
forUpdate(...tableNames: string[]): QueryBuilder<TRecord, TResult>;
|
|
1808
1884
|
forUpdate(tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;
|
|
@@ -1856,7 +1932,7 @@ export declare namespace Knex {
|
|
|
1856
1932
|
readonly [Symbol.toStringTag]: string;
|
|
1857
1933
|
}
|
|
1858
1934
|
interface ChainableInterface<T = any> extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>, StringTagSupport {
|
|
1859
|
-
generateDdlCommands(): Promise<{ pre: string[], sql: string[], post: string[] }>;
|
|
1935
|
+
generateDdlCommands(): Promise<{ pre: string[], sql: string[], check: string | null, post: string[] }>;
|
|
1860
1936
|
toQuery(): string;
|
|
1861
1937
|
options(options: Readonly<{ [key: string]: any }>): this;
|
|
1862
1938
|
connection(connection: any): this;
|
|
@@ -1993,6 +2069,9 @@ export declare namespace Knex {
|
|
|
1993
2069
|
renameColumn(from: string, to: string): TableBuilder;
|
|
1994
2070
|
integer(columnName: string, length?: number): ColumnBuilder;
|
|
1995
2071
|
tinyint(columnName: string, length?: number): ColumnBuilder;
|
|
2072
|
+
smallint(columnName: string): ColumnBuilder;
|
|
2073
|
+
mediumint(columnName: string): ColumnBuilder;
|
|
2074
|
+
bigint(columnName: string): ColumnBuilder;
|
|
1996
2075
|
bigInteger(columnName: string): ColumnBuilder;
|
|
1997
2076
|
text(columnName: string, textType?: string): ColumnBuilder;
|
|
1998
2077
|
string(columnName: string, length?: number): ColumnBuilder;
|
|
@@ -2020,8 +2099,12 @@ export declare namespace Knex {
|
|
|
2020
2099
|
/** @deprecated */
|
|
2021
2100
|
timestamp(columnName: string, withoutTz?: boolean, precision?: number): ColumnBuilder;
|
|
2022
2101
|
timestamps(
|
|
2023
|
-
|
|
2024
|
-
|
|
2102
|
+
useTimestamps?: boolean,
|
|
2103
|
+
defaultToNow?: boolean,
|
|
2104
|
+
useCamelCase?: boolean
|
|
2105
|
+
): ColumnBuilder;
|
|
2106
|
+
timestamps(
|
|
2107
|
+
options?: Readonly<{useTimestamps?: boolean, defaultToNow?: boolean, useCamelCase?: boolean}>
|
|
2025
2108
|
): void;
|
|
2026
2109
|
geometry(columnName: string): ColumnBuilder;
|
|
2027
2110
|
geography(columnName: string): ColumnBuilder;
|
|
@@ -2039,7 +2122,7 @@ export declare namespace Knex {
|
|
|
2039
2122
|
): ColumnBuilder;
|
|
2040
2123
|
json(columnName: string): ColumnBuilder;
|
|
2041
2124
|
jsonb(columnName: string): ColumnBuilder;
|
|
2042
|
-
uuid(columnName: string): ColumnBuilder;
|
|
2125
|
+
uuid(columnName: string, options?: Readonly<{useBinaryUuid?: boolean}>): ColumnBuilder;
|
|
2043
2126
|
comment(val: string): void;
|
|
2044
2127
|
specificType(columnName: string, type: string): ColumnBuilder;
|
|
2045
2128
|
primary(columnNames: readonly string[], options?: Readonly<{constraintName?: string, deferrable?: deferrableType}>): TableBuilder;
|
|
@@ -2057,7 +2140,7 @@ export declare namespace Knex {
|
|
|
2057
2140
|
): TableBuilder;
|
|
2058
2141
|
setNullable(column: string): TableBuilder;
|
|
2059
2142
|
dropNullable(column: string): TableBuilder;
|
|
2060
|
-
unique(columnNames: readonly (string | Raw)[], options?: Readonly<{indexName?: string, storageEngineIndexType?: string, deferrable?: deferrableType}>): TableBuilder;
|
|
2143
|
+
unique(columnNames: readonly (string | Raw)[], options?: Readonly<{indexName?: string, storageEngineIndexType?: string, deferrable?: deferrableType, useConstraint?: boolean}>): TableBuilder;
|
|
2061
2144
|
/** @deprecated */
|
|
2062
2145
|
unique(columnNames: readonly (string | Raw)[], indexName?: string): TableBuilder;
|
|
2063
2146
|
foreign(column: string, foreignKeyName?: string): ForeignConstraintBuilder;
|
|
@@ -2065,11 +2148,13 @@ export declare namespace Knex {
|
|
|
2065
2148
|
columns: readonly string[],
|
|
2066
2149
|
foreignKeyName?: string
|
|
2067
2150
|
): MultikeyForeignConstraintBuilder;
|
|
2151
|
+
check(checkPredicate: string, bindings?: Record<string, any>, constraintName?: string): TableBuilder;
|
|
2068
2152
|
dropForeign(columnNames: string | readonly string[], foreignKeyName?: string): TableBuilder;
|
|
2069
2153
|
dropUnique(columnNames: readonly (string | Raw)[], indexName?: string): TableBuilder;
|
|
2070
2154
|
dropPrimary(constraintName?: string): TableBuilder;
|
|
2071
2155
|
dropIndex(columnNames: string | readonly (string | Raw)[], indexName?: string): TableBuilder;
|
|
2072
|
-
dropTimestamps(): TableBuilder;
|
|
2156
|
+
dropTimestamps(useCamelCase?: boolean): TableBuilder;
|
|
2157
|
+
dropChecks(checkConstraintNames: string | string[]): TableBuilder;
|
|
2073
2158
|
queryContext(context: any): TableBuilder;
|
|
2074
2159
|
}
|
|
2075
2160
|
|
|
@@ -2102,6 +2187,7 @@ export declare namespace Knex {
|
|
|
2102
2187
|
|
|
2103
2188
|
type deferrableType = 'not deferrable' | 'immediate' | 'deferred';
|
|
2104
2189
|
type storageEngineIndexType = 'hash' | 'btree';
|
|
2190
|
+
type lengthOperator = '>' | '<' | '<=' | '>=' | '!=' | '=';
|
|
2105
2191
|
|
|
2106
2192
|
interface ColumnBuilder {
|
|
2107
2193
|
index(indexName?: string): ColumnBuilder;
|
|
@@ -2122,7 +2208,15 @@ export declare namespace Knex {
|
|
|
2122
2208
|
queryContext(context: any): ColumnBuilder;
|
|
2123
2209
|
after(columnName: string): ColumnBuilder;
|
|
2124
2210
|
first(): ColumnBuilder;
|
|
2211
|
+
checkPositive(constraintName?: string): ColumnBuilder;
|
|
2212
|
+
checkNegative(constraintName?: string): ColumnBuilder;
|
|
2213
|
+
checkIn(values: string[], constraintName?: string): ColumnBuilder;
|
|
2214
|
+
checkNotIn(values: string[], constraintName?: string): ColumnBuilder;
|
|
2215
|
+
checkBetween(values: any[] | any[][], constraintName?: string): ColumnBuilder;
|
|
2216
|
+
checkLength(operator: lengthOperator, length: number, constraintName?: string): ColumnBuilder;
|
|
2217
|
+
checkRegex(regex: string, constraintName?: string): ColumnBuilder;
|
|
2125
2218
|
}
|
|
2219
|
+
|
|
2126
2220
|
interface ForeignConstraintBuilder {
|
|
2127
2221
|
references(columnName: string): ReferencingColumnBuilder;
|
|
2128
2222
|
}
|
|
@@ -2592,6 +2686,15 @@ export declare namespace Knex {
|
|
|
2592
2686
|
forceFreeMigrationsLock(config?: MigratorConfig): Promise<any>;
|
|
2593
2687
|
}
|
|
2594
2688
|
|
|
2689
|
+
interface Seed {
|
|
2690
|
+
seed: (knex: Knex) => PromiseLike<void>;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
interface SeedSource<TSeedSpec> {
|
|
2694
|
+
getSeeds(config: SeederConfig): Promise<TSeedSpec[]>;
|
|
2695
|
+
getSeed(seed: TSeedSpec): Promise<Seed>;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2595
2698
|
interface SeederConfig<V extends {} = any> {
|
|
2596
2699
|
extension?: string;
|
|
2597
2700
|
directory?: string | readonly string[];
|
|
@@ -2602,6 +2705,7 @@ export declare namespace Knex {
|
|
|
2602
2705
|
sortDirsSeparately?: boolean;
|
|
2603
2706
|
stub?: string;
|
|
2604
2707
|
variables?: V;
|
|
2708
|
+
seedSource?: SeedSource<unknown>;
|
|
2605
2709
|
}
|
|
2606
2710
|
|
|
2607
2711
|
class Seeder {
|