knex 0.95.12 → 0.95.13

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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # Master (Unreleased)
2
2
 
3
+ # 0.95.13 - 02 November, 2021
4
+
5
+ ### Bug fixes:
6
+
7
+ - PostgreSQL: Support zero precision in timestamp/datetime #4784
8
+
9
+ ### Typings:
10
+
11
+ - Allow string indexType in index creation #4791
12
+
3
13
  # 0.95.12 - 28 October, 2021
4
14
 
5
15
  ### New features:
@@ -72,22 +72,16 @@ class ColumnCompiler_PG extends ColumnCompiler {
72
72
  useTz = !withoutTz;
73
73
  }
74
74
  useTz = typeof useTz === 'boolean' ? useTz : true;
75
- precision = precision ? '(' + precision + ')' : '';
75
+ precision =
76
+ precision !== undefined && precision !== null
77
+ ? '(' + precision + ')'
78
+ : '';
76
79
 
77
80
  return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`;
78
81
  }
79
82
 
80
83
  timestamp(withoutTz = false, precision) {
81
- let useTz;
82
- if (isObject(withoutTz)) {
83
- ({ useTz, precision } = withoutTz);
84
- } else {
85
- useTz = !withoutTz;
86
- }
87
- useTz = typeof useTz === 'boolean' ? useTz : true;
88
- precision = precision ? '(' + precision + ')' : '';
89
-
90
- return `${useTz ? 'timestamptz' : 'timestamp'}${precision}`;
84
+ return this.datetime(withoutTz, precision);
91
85
  }
92
86
 
93
87
  // Modifiers:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knex",
3
- "version": "0.95.12",
3
+ "version": "0.95.13",
4
4
  "description": "A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3",
5
5
  "main": "knex",
6
6
  "types": "types/index.d.ts",
package/types/index.d.ts CHANGED
@@ -2045,6 +2045,11 @@ export declare namespace Knex {
2045
2045
  primary(columnNames: readonly string[], options?: Readonly<{constraintName?: string, deferrable?: deferrableType}>): TableBuilder;
2046
2046
  /** @deprecated */
2047
2047
  primary(columnNames: readonly string[], constraintName?: string): TableBuilder;
2048
+ index(
2049
+ columnNames: string | readonly (string | Raw)[],
2050
+ indexName?: string,
2051
+ indexType?: string
2052
+ ): TableBuilder;
2048
2053
  index(
2049
2054
  columnNames: string | readonly (string | Raw)[],
2050
2055
  indexName?: string,
@@ -2131,6 +2136,7 @@ export declare namespace Knex {
2131
2136
  indexName?: string,
2132
2137
  options?: Readonly<{indexType?: string, predicate?: QueryBuilder}>
2133
2138
  ): ColumnBuilder;
2139
+ index(indexName?: string, indexType?: string): ColumnBuilder;
2134
2140
  }
2135
2141
 
2136
2142
  interface SqlLiteColumnBuilder extends ColumnBuilder {