knex 0.95.14 → 1.0.2

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +90 -1
  2. package/README.md +1 -1
  3. package/UPGRADING.md +7 -0
  4. package/lib/client.js +14 -1
  5. package/lib/constants.js +2 -0
  6. package/lib/dialects/better-sqlite3/index.js +72 -0
  7. package/lib/dialects/cockroachdb/crdb-querycompiler.js +92 -33
  8. package/lib/dialects/cockroachdb/crdb-tablecompiler.js +19 -0
  9. package/lib/dialects/cockroachdb/index.js +13 -0
  10. package/lib/dialects/mssql/index.js +0 -11
  11. package/lib/dialects/mssql/query/mssql-querycompiler.js +122 -64
  12. package/lib/dialects/mssql/schema/mssql-columncompiler.js +41 -6
  13. package/lib/dialects/mssql/schema/mssql-compiler.js +3 -4
  14. package/lib/dialects/mssql/schema/mssql-tablecompiler.js +24 -9
  15. package/lib/dialects/mssql/schema/mssql-viewcompiler.js +15 -1
  16. package/lib/dialects/mysql/query/mysql-querycompiler.js +93 -5
  17. package/lib/dialects/mysql/schema/mysql-columncompiler.js +32 -5
  18. package/lib/dialects/mysql/schema/mysql-tablecompiler.js +33 -6
  19. package/lib/dialects/oracle/query/oracle-querycompiler.js +7 -6
  20. package/lib/dialects/oracle/schema/internal/trigger.js +1 -1
  21. package/lib/dialects/oracle/schema/oracle-columncompiler.js +10 -4
  22. package/lib/dialects/oracle/schema/oracle-tablecompiler.js +17 -6
  23. package/lib/dialects/oracledb/index.js +0 -4
  24. package/lib/dialects/oracledb/query/oracledb-querycompiler.js +89 -0
  25. package/lib/dialects/oracledb/schema/oracledb-columncompiler.js +23 -0
  26. package/lib/dialects/postgres/index.js +21 -6
  27. package/lib/dialects/postgres/query/pg-querybuilder.js +38 -0
  28. package/lib/dialects/postgres/query/pg-querycompiler.js +172 -9
  29. package/lib/dialects/postgres/schema/pg-columncompiler.js +24 -4
  30. package/lib/dialects/postgres/schema/pg-tablecompiler.js +63 -46
  31. package/lib/dialects/redshift/index.js +12 -0
  32. package/lib/dialects/redshift/query/redshift-querycompiler.js +62 -26
  33. package/lib/dialects/redshift/schema/redshift-columncompiler.js +2 -1
  34. package/lib/dialects/redshift/schema/redshift-tablecompiler.js +4 -1
  35. package/lib/dialects/sqlite3/index.js +23 -4
  36. package/lib/dialects/sqlite3/query/sqlite-querybuilder.js +33 -0
  37. package/lib/dialects/sqlite3/query/sqlite-querycompiler.js +87 -22
  38. package/lib/dialects/sqlite3/schema/ddl.js +274 -282
  39. package/lib/dialects/sqlite3/schema/internal/sqlite-ddl-operations.js +18 -8
  40. package/lib/dialects/sqlite3/schema/sqlite-columncompiler.js +20 -0
  41. package/lib/dialects/sqlite3/schema/sqlite-compiler.js +16 -12
  42. package/lib/dialects/sqlite3/schema/sqlite-tablecompiler.js +15 -5
  43. package/lib/dialects/sqlite3/schema/sqlite-viewcompiler.js +31 -2
  44. package/lib/execution/runner.js +37 -2
  45. package/lib/knex-builder/FunctionHelper.js +36 -0
  46. package/lib/migrations/common/MigrationsLoader.js +36 -0
  47. package/lib/migrations/migrate/MigrationGenerator.js +1 -1
  48. package/lib/migrations/migrate/Migrator.js +22 -24
  49. package/lib/migrations/migrate/migration-list-resolver.js +2 -5
  50. package/lib/migrations/migrate/{configuration-merger.js → migrator-configuration-merger.js} +2 -4
  51. package/lib/migrations/migrate/sources/fs-migrations.js +4 -29
  52. package/lib/migrations/migrate/stub/js.stub +8 -1
  53. package/lib/migrations/migrate/stub/knexfile-js.stub +3 -0
  54. package/lib/migrations/migrate/stub/knexfile-ts.stub +5 -2
  55. package/lib/migrations/migrate/table-creator.js +6 -5
  56. package/lib/migrations/seed/Seeder.js +25 -92
  57. package/lib/migrations/seed/seeder-configuration-merger.js +60 -0
  58. package/lib/migrations/seed/sources/fs-seeds.js +65 -0
  59. package/lib/migrations/seed/stub/js.stub +4 -1
  60. package/lib/migrations/util/import-file.js +0 -1
  61. package/lib/query/joinclause.js +24 -5
  62. package/lib/query/method-constants.js +37 -0
  63. package/lib/query/querybuilder.js +292 -53
  64. package/lib/query/querycompiler.js +309 -85
  65. package/lib/schema/columnbuilder.js +14 -1
  66. package/lib/schema/columncompiler.js +132 -5
  67. package/lib/schema/compiler.js +1 -0
  68. package/lib/schema/tablebuilder.js +41 -8
  69. package/lib/schema/tablecompiler.js +61 -4
  70. package/lib/schema/viewcompiler.js +13 -10
  71. package/package.json +37 -27
  72. package/scripts/docker-compose.yml +7 -7
  73. package/scripts/oracledb-install-driver-libs.sh +82 -0
  74. package/scripts/runkit-example.js +1 -1
  75. package/scripts/stress-test/docker-compose.yml +3 -3
  76. package/scripts/stress-test/knex-stress-test.js +1 -1
  77. package/scripts/stress-test/reconnect-test-mysql-based-drivers.js +1 -1
  78. package/types/index.d.ts +133 -21
@@ -14,7 +14,7 @@ services:
14
14
  - "mysql"
15
15
  - "postgresql"
16
16
  - "pgnative"
17
- - "oracledbxe"
17
+ - "oracledb"
18
18
  - "mssql"
19
19
 
20
20
  mysql:
@@ -41,8 +41,8 @@ services:
41
41
  - POSTGRES_PASSWORD=postgresrootpassword
42
42
  - POSTGRES_USER=postgres
43
43
 
44
- oracledbxe:
45
- image: wnameless/oracle-xe-11g
44
+ oracledb:
45
+ image: quillbuilduser/oracle-18-xe
46
46
  ports:
47
47
  - "31521:1521"
48
48
  environment:
@@ -163,7 +163,7 @@ async function main() {
163
163
  await recreateProxy('postgresql', 25432, 5432);
164
164
  await recreateProxy('postgresql', 25433, 5433);
165
165
  await recreateProxy('mysql', 23306, 3306);
166
- await recreateProxy('oracledbxe', 21521, 1521);
166
+ await recreateProxy('oracledb', 21521, 1521);
167
167
  await recreateProxy('mssql', 21433, 1433);
168
168
  }
169
169
 
@@ -147,7 +147,7 @@ async function main() {
147
147
  console.log('----- Recreating proxies -> cutting connections completely');
148
148
  await recreateProxy('postgresql', 25432, 5432);
149
149
  await recreateProxy('mysql', 23306, 3306);
150
- await recreateProxy('oracledbxe', 21521, 1521);
150
+ await recreateProxy('oracledb', 21521, 1521);
151
151
  }
152
152
  setInterval(() => recreateProxies(), 2000);
153
153
 
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 = unknown[]>
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,8 +509,19 @@ 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>;
523
+ withMaterialized: With<TRecord, TResult>;
524
+ withNotMaterialized: With<TRecord, TResult>;
513
525
  withRecursive: With<TRecord, TResult>;
514
526
  withRaw: WithRaw<TRecord, TResult>;
515
527
  withSchema: WithSchema<TRecord, TResult>;
@@ -535,6 +547,8 @@ export declare namespace Knex {
535
547
  orWhereIn: WhereIn<TRecord, TResult>;
536
548
  whereNotIn: WhereIn<TRecord, TResult>;
537
549
  orWhereNotIn: WhereIn<TRecord, TResult>;
550
+ whereLike: Where<TRecord, TResult>;
551
+ whereILike: Where<TRecord, TResult>;
538
552
  whereNull: WhereNull<TRecord, TResult>;
539
553
  orWhereNull: WhereNull<TRecord, TResult>;
540
554
  whereNotNull: WhereNull<TRecord, TResult>;
@@ -546,6 +560,31 @@ export declare namespace Knex {
546
560
  orWhereNotBetween: WhereBetween<TRecord, TResult>;
547
561
  andWhereNotBetween: WhereBetween<TRecord, TResult>;
548
562
 
563
+ whereJsonObject: WhereJsonObject<TRecord, TResult>;
564
+ orWhereJsonObject: WhereJsonObject<TRecord, TResult>;
565
+ andWhereJsonObject: WhereJsonObject<TRecord, TResult>;
566
+ whereNotJsonObject: WhereJsonObject<TRecord, TResult>;
567
+ orWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
568
+ andWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
569
+
570
+ whereJsonPath: WhereJsonPath<TRecord, TResult>;
571
+ orWhereJsonPath: WhereJsonPath<TRecord, TResult>;
572
+ andWhereJsonPath: WhereJsonPath<TRecord, TResult>;
573
+
574
+ whereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
575
+ orWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
576
+ andWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
577
+ whereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
578
+ orWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
579
+ andWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
580
+
581
+ whereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
582
+ orWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
583
+ andWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
584
+ whereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
585
+ orWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
586
+ andWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
587
+
549
588
  // Group by
550
589
  groupBy: GroupBy<TRecord, TResult>;
551
590
  groupByRaw: RawQueryBuilder<TRecord, TResult>;
@@ -602,8 +641,8 @@ export declare namespace Knex {
602
641
  clear(statement: ClearStatements): QueryBuilder<TRecord, TResult>;
603
642
 
604
643
  // Paging
605
- offset(offset: number): QueryBuilder<TRecord, TResult>;
606
- limit(limit: number): QueryBuilder<TRecord, TResult>;
644
+ offset(offset: number, options?: boolean | Readonly<{skipBinding?: boolean}>): QueryBuilder<TRecord, TResult>;
645
+ limit(limit: number, options?: string | Readonly<{skipBinding?: boolean}>): QueryBuilder<TRecord, TResult>;
607
646
 
608
647
  // Aggregation
609
648
  count: AsymmetricAggregation<TRecord, TResult, Lookup<ResultTypes.Registry, "Count", number | string>>;
@@ -908,7 +947,7 @@ export declare namespace Knex {
908
947
  options?: DMLOptions
909
948
  ): QueryBuilder<TRecord, TResult2>;
910
949
  returning<TResult2 = SafePartial<TRecord>[]>(
911
- column: string | readonly string[],
950
+ column: string | readonly (string | Raw)[] | Raw,
912
951
  options?: DMLOptions
913
952
  ): QueryBuilder<TRecord, TResult2>;
914
953
 
@@ -940,6 +979,10 @@ export declare namespace Knex {
940
979
  columns: string[]
941
980
  ): OnConflictQueryBuilder<TRecord, TResult>;
942
981
 
982
+ onConflict(
983
+ raw: Raw
984
+ ): OnConflictQueryBuilder<TRecord, TResult>;
985
+
943
986
  onConflict(): OnConflictQueryBuilder<TRecord, TResult>;
944
987
 
945
988
  del(
@@ -1001,7 +1044,7 @@ export declare namespace Knex {
1001
1044
  options?: DMLOptions
1002
1045
  ): QueryBuilder<TRecord, TResult2>;
1003
1046
  delete<TResult2 = any>(
1004
- returning: string | readonly string[],
1047
+ returning: string | readonly (string | Raw)[] | Raw,
1005
1048
  options?: DMLOptions
1006
1049
  ): QueryBuilder<TRecord, TResult2>;
1007
1050
  delete<TResult2 = number>(): QueryBuilder<TRecord, TResult2>;
@@ -1091,6 +1134,30 @@ export declare namespace Knex {
1091
1134
  ): QueryBuilder<TRecord, TResult2>;
1092
1135
  }
1093
1136
 
1137
+ interface JsonExtraction {
1138
+ column: string | Raw | QueryBuilder;
1139
+ path: string;
1140
+ alias?: string;
1141
+ singleValue?: boolean;
1142
+ }
1143
+
1144
+ interface JsonExtract<TRecord extends {} = any, TResult extends {} = any> {
1145
+ (column: string | Raw | QueryBuilder, path: string, alias?: string, singleValue?: boolean): QueryBuilder<TRecord, TResult>;
1146
+ (column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder<TRecord, TResult>;
1147
+ }
1148
+
1149
+ interface JsonSet<TRecord extends {} = any, TResult extends {} = any> {
1150
+ (column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
1151
+ }
1152
+
1153
+ interface JsonInsert<TRecord extends {} = any, TResult extends {} = any> {
1154
+ (column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
1155
+ }
1156
+
1157
+ interface JsonRemove<TRecord extends {} = any, TResult extends {} = any> {
1158
+ (column: string | Raw | QueryBuilder, path: string, alias?: string): QueryBuilder<TRecord, TResult>;
1159
+ }
1160
+
1094
1161
  interface HintComment<TRecord extends {} = any, TResult extends {} = any> {
1095
1162
  (hint: string): QueryBuilder<TRecord, TResult>;
1096
1163
  (hints: readonly string[]): QueryBuilder<TRecord, TResult>;
@@ -1298,12 +1365,12 @@ export declare namespace Knex {
1298
1365
  andOnVal(column1: string, operator: string, value: Value): JoinClause;
1299
1366
  orOnVal(column1: string, value: Value): JoinClause;
1300
1367
  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;
1368
+ onIn(column1: string, values: readonly any[] | Raw): JoinClause;
1369
+ andOnIn(column1: string, values: readonly any[] | Raw): JoinClause;
1370
+ orOnIn(column1: string, values: readonly any[] | Raw): JoinClause;
1371
+ onNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
1372
+ andOnNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
1373
+ orOnNotIn(column1: string, values: readonly any[] | Raw): JoinClause;
1307
1374
  onNull(column1: string): JoinClause;
1308
1375
  andOnNull(column1: string): JoinClause;
1309
1376
  orOnNull(column1: string): JoinClause;
@@ -1322,6 +1389,8 @@ export declare namespace Knex {
1322
1389
  onNotBetween(column1: string, range: readonly [any, any]): JoinClause;
1323
1390
  andOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
1324
1391
  orOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
1392
+ onJsonPathEquals(columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string): JoinClause;
1393
+ orOnJsonPathEquals(columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string): JoinClause;
1325
1394
  using(
1326
1395
  column: string | readonly string[] | Raw | { [key: string]: string | Raw }
1327
1396
  ): JoinClause;
@@ -1335,6 +1404,10 @@ export declare namespace Knex {
1335
1404
  >;
1336
1405
  }
1337
1406
 
1407
+ interface Using<TRecord = any, TResult = unknown[]> {
1408
+ (tables: string[]): QueryBuilder<TRecord, TResult>;
1409
+ }
1410
+
1338
1411
  interface With<TRecord = any, TResult = unknown[]>
1339
1412
  extends WithRaw<TRecord, TResult>,
1340
1413
  WithWrapped<TRecord, TResult> {}
@@ -1453,6 +1526,14 @@ export declare namespace Knex {
1453
1526
  ): QueryBuilder<TRecord, TResult>;
1454
1527
  }
1455
1528
 
1529
+ interface WhereJsonObject<TRecord = any, TResult = unknown[]> {
1530
+ (columnName: keyof TRecord, value: any): QueryBuilder<TRecord, TResult>;
1531
+ }
1532
+
1533
+ interface WhereJsonPath<TRecord = any, TResult = unknown[]> {
1534
+ (columnName: keyof TRecord, jsonPath: string, operator: string, value: any): QueryBuilder<TRecord, TResult>;
1535
+ }
1536
+
1456
1537
  interface WhereIn<TRecord = any, TResult = unknown[]> {
1457
1538
  <K extends keyof ResolveTableType<TRecord>>(
1458
1539
  columnName: K,
@@ -1771,7 +1852,7 @@ export declare namespace Knex {
1771
1852
  ): BatchInsertBuilder<TRecord, TResult2>;
1772
1853
  // if data with specific type passed, exclude this method
1773
1854
  returning<TResult2 = SafePartial<TRecord>[]>(
1774
- column: unknown extends TRecord ? string | readonly string[] : never
1855
+ column: unknown extends TRecord ? string | readonly (string | Raw)[] | Raw: never
1775
1856
  ): BatchInsertBuilder<TRecord, TResult2>;
1776
1857
  }
1777
1858
 
@@ -1802,7 +1883,8 @@ export declare namespace Knex {
1802
1883
  and: QueryBuilder<TRecord, TResult>;
1803
1884
 
1804
1885
  // TODO: Promise?
1805
- columnInfo(column?: keyof TRecord): Promise<ColumnInfo>;
1886
+ columnInfo(column: keyof DeferredKeySelection.Resolve<TRecord>): Promise<ColumnInfo>;
1887
+ columnInfo(): Promise<Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>>;
1806
1888
 
1807
1889
  forUpdate(...tableNames: string[]): QueryBuilder<TRecord, TResult>;
1808
1890
  forUpdate(tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;
@@ -1856,7 +1938,7 @@ export declare namespace Knex {
1856
1938
  readonly [Symbol.toStringTag]: string;
1857
1939
  }
1858
1940
  interface ChainableInterface<T = any> extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>, StringTagSupport {
1859
- generateDdlCommands(): Promise<{ pre: string[], sql: string[], post: string[] }>;
1941
+ generateDdlCommands(): Promise<{ pre: string[], sql: string[], check: string | null, post: string[] }>;
1860
1942
  toQuery(): string;
1861
1943
  options(options: Readonly<{ [key: string]: any }>): this;
1862
1944
  connection(connection: any): this;
@@ -1993,6 +2075,9 @@ export declare namespace Knex {
1993
2075
  renameColumn(from: string, to: string): TableBuilder;
1994
2076
  integer(columnName: string, length?: number): ColumnBuilder;
1995
2077
  tinyint(columnName: string, length?: number): ColumnBuilder;
2078
+ smallint(columnName: string): ColumnBuilder;
2079
+ mediumint(columnName: string): ColumnBuilder;
2080
+ bigint(columnName: string): ColumnBuilder;
1996
2081
  bigInteger(columnName: string): ColumnBuilder;
1997
2082
  text(columnName: string, textType?: string): ColumnBuilder;
1998
2083
  string(columnName: string, length?: number): ColumnBuilder;
@@ -2020,8 +2105,12 @@ export declare namespace Knex {
2020
2105
  /** @deprecated */
2021
2106
  timestamp(columnName: string, withoutTz?: boolean, precision?: number): ColumnBuilder;
2022
2107
  timestamps(
2023
- useTimestampType?: boolean,
2024
- makeDefaultNow?: boolean
2108
+ useTimestamps?: boolean,
2109
+ defaultToNow?: boolean,
2110
+ useCamelCase?: boolean
2111
+ ): ColumnBuilder;
2112
+ timestamps(
2113
+ options?: Readonly<{useTimestamps?: boolean, defaultToNow?: boolean, useCamelCase?: boolean}>
2025
2114
  ): void;
2026
2115
  geometry(columnName: string): ColumnBuilder;
2027
2116
  geography(columnName: string): ColumnBuilder;
@@ -2039,7 +2128,7 @@ export declare namespace Knex {
2039
2128
  ): ColumnBuilder;
2040
2129
  json(columnName: string): ColumnBuilder;
2041
2130
  jsonb(columnName: string): ColumnBuilder;
2042
- uuid(columnName: string): ColumnBuilder;
2131
+ uuid(columnName: string, options?: Readonly<{useBinaryUuid?: boolean}>): ColumnBuilder;
2043
2132
  comment(val: string): void;
2044
2133
  specificType(columnName: string, type: string): ColumnBuilder;
2045
2134
  primary(columnNames: readonly string[], options?: Readonly<{constraintName?: string, deferrable?: deferrableType}>): TableBuilder;
@@ -2057,7 +2146,7 @@ export declare namespace Knex {
2057
2146
  ): TableBuilder;
2058
2147
  setNullable(column: string): TableBuilder;
2059
2148
  dropNullable(column: string): TableBuilder;
2060
- unique(columnNames: readonly (string | Raw)[], options?: Readonly<{indexName?: string, storageEngineIndexType?: string, deferrable?: deferrableType}>): TableBuilder;
2149
+ unique(columnNames: readonly (string | Raw)[], options?: Readonly<{indexName?: string, storageEngineIndexType?: string, deferrable?: deferrableType, useConstraint?: boolean}>): TableBuilder;
2061
2150
  /** @deprecated */
2062
2151
  unique(columnNames: readonly (string | Raw)[], indexName?: string): TableBuilder;
2063
2152
  foreign(column: string, foreignKeyName?: string): ForeignConstraintBuilder;
@@ -2065,11 +2154,13 @@ export declare namespace Knex {
2065
2154
  columns: readonly string[],
2066
2155
  foreignKeyName?: string
2067
2156
  ): MultikeyForeignConstraintBuilder;
2157
+ check(checkPredicate: string, bindings?: Record<string, any>, constraintName?: string): TableBuilder;
2068
2158
  dropForeign(columnNames: string | readonly string[], foreignKeyName?: string): TableBuilder;
2069
2159
  dropUnique(columnNames: readonly (string | Raw)[], indexName?: string): TableBuilder;
2070
2160
  dropPrimary(constraintName?: string): TableBuilder;
2071
2161
  dropIndex(columnNames: string | readonly (string | Raw)[], indexName?: string): TableBuilder;
2072
- dropTimestamps(): TableBuilder;
2162
+ dropTimestamps(useCamelCase?: boolean): TableBuilder;
2163
+ dropChecks(checkConstraintNames: string | string[]): TableBuilder;
2073
2164
  queryContext(context: any): TableBuilder;
2074
2165
  }
2075
2166
 
@@ -2102,6 +2193,7 @@ export declare namespace Knex {
2102
2193
 
2103
2194
  type deferrableType = 'not deferrable' | 'immediate' | 'deferred';
2104
2195
  type storageEngineIndexType = 'hash' | 'btree';
2196
+ type lengthOperator = '>' | '<' | '<=' | '>=' | '!=' | '=';
2105
2197
 
2106
2198
  interface ColumnBuilder {
2107
2199
  index(indexName?: string): ColumnBuilder;
@@ -2118,11 +2210,19 @@ export declare namespace Knex {
2118
2210
  notNullable(): ColumnBuilder;
2119
2211
  nullable(): ColumnBuilder;
2120
2212
  comment(value: string): ColumnBuilder;
2121
- alter(): ColumnBuilder;
2213
+ alter(options: Readonly<{alterNullable?: boolean, alterType?: boolean}>): ColumnBuilder;
2122
2214
  queryContext(context: any): ColumnBuilder;
2123
2215
  after(columnName: string): ColumnBuilder;
2124
2216
  first(): ColumnBuilder;
2217
+ checkPositive(constraintName?: string): ColumnBuilder;
2218
+ checkNegative(constraintName?: string): ColumnBuilder;
2219
+ checkIn(values: string[], constraintName?: string): ColumnBuilder;
2220
+ checkNotIn(values: string[], constraintName?: string): ColumnBuilder;
2221
+ checkBetween(values: any[] | any[][], constraintName?: string): ColumnBuilder;
2222
+ checkLength(operator: lengthOperator, length: number, constraintName?: string): ColumnBuilder;
2223
+ checkRegex(regex: string, constraintName?: string): ColumnBuilder;
2125
2224
  }
2225
+
2126
2226
  interface ForeignConstraintBuilder {
2127
2227
  references(columnName: string): ReferencingColumnBuilder;
2128
2228
  }
@@ -2592,6 +2692,15 @@ export declare namespace Knex {
2592
2692
  forceFreeMigrationsLock(config?: MigratorConfig): Promise<any>;
2593
2693
  }
2594
2694
 
2695
+ interface Seed {
2696
+ seed: (knex: Knex) => PromiseLike<void>;
2697
+ }
2698
+
2699
+ interface SeedSource<TSeedSpec> {
2700
+ getSeeds(config: SeederConfig): Promise<TSeedSpec[]>;
2701
+ getSeed(seed: TSeedSpec): Promise<Seed>;
2702
+ }
2703
+
2595
2704
  interface SeederConfig<V extends {} = any> {
2596
2705
  extension?: string;
2597
2706
  directory?: string | readonly string[];
@@ -2602,6 +2711,7 @@ export declare namespace Knex {
2602
2711
  sortDirsSeparately?: boolean;
2603
2712
  stub?: string;
2604
2713
  variables?: V;
2714
+ seedSource?: SeedSource<unknown>;
2605
2715
  }
2606
2716
 
2607
2717
  class Seeder {
@@ -2613,6 +2723,8 @@ export declare namespace Knex {
2613
2723
 
2614
2724
  interface FunctionHelper {
2615
2725
  now(precision?: number): Raw;
2726
+ uuidToBin(uuid: string, ordered?: boolean): Buffer;
2727
+ binToUuid(bin: Buffer, ordered?: boolean): string;
2616
2728
  }
2617
2729
 
2618
2730
  interface EnumOptions {