pqb 0.18.0 → 0.18.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.
package/dist/index.d.ts CHANGED
@@ -4865,7 +4865,7 @@ declare const raw: <T = unknown>(...args: RawSQLArgs) => RawSQL<ColumnTypeBase<T
4865
4865
  decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): DecimalColumn<Precision_1, Scale_1>;
4866
4866
  real(): RealColumn;
4867
4867
  doublePrecision(): DoublePrecisionColumn;
4868
- identity(options?: TableData.Identity | undefined): IdentityColumn<IntegerColumn>;
4868
+ identity(options?: TableData.Identity | undefined): orchid_core.ColumnWithDefault<IntegerColumn, orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>>>;
4869
4869
  smallSerial(): SmallSerialColumn;
4870
4870
  serial(): SerialColumn;
4871
4871
  bigSerial(): BigSerialColumn;
@@ -6487,7 +6487,7 @@ declare const columnTypes: {
6487
6487
  decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): DecimalColumn<Precision_1, Scale_1>;
6488
6488
  real(): RealColumn;
6489
6489
  doublePrecision(): DoublePrecisionColumn;
6490
- identity(options?: TableData.Identity): IdentityColumn<IntegerColumn>;
6490
+ identity(options?: TableData.Identity): orchid_core.ColumnWithDefault<IntegerColumn, orchid_core.Expression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, orchid_core.ColumnDataBase>>>;
6491
6491
  smallSerial(): SmallSerialColumn;
6492
6492
  serial(): SerialColumn;
6493
6493
  bigSerial(): BigSerialColumn;
@@ -6868,7 +6868,7 @@ declare const simplifyColumnDefault: (value?: string) => RawSQL<ColumnTypeBase<u
6868
6868
  decimal<Precision_1 extends number | undefined = undefined, Scale_1 extends number | undefined = undefined>(precision?: Precision_1 | undefined, scale?: Scale_1 | undefined): DecimalColumn<Precision_1, Scale_1>;
6869
6869
  real(): RealColumn;
6870
6870
  doublePrecision(): DoublePrecisionColumn;
6871
- identity(options?: TableData.Identity | undefined): IdentityColumn<IntegerColumn>;
6871
+ identity(options?: TableData.Identity | undefined): orchid_core.ColumnWithDefault<IntegerColumn, orchid_core.Expression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, unknown, unknown, ColumnDataBase>>>;
6872
6872
  smallSerial(): SmallSerialColumn;
6873
6873
  serial(): SerialColumn;
6874
6874
  bigSerial(): BigSerialColumn;
package/dist/index.js CHANGED
@@ -806,7 +806,7 @@ const columnCode = (type, t, code, data = type.data, skip) => {
806
806
  orchidCore.addCode(code, `.parse(${type.parseFn.toString()})`);
807
807
  if (data.as)
808
808
  orchidCore.addCode(code, `.as(${data.as.toCode(t)})`);
809
- if (data.default !== void 0 && data.default !== null) {
809
+ if (data.default !== void 0) {
810
810
  orchidCore.addCode(code, `.default(${orchidCore.columnDefaultArgumentToCode(t, data.default)})`);
811
811
  }
812
812
  if (data.indexes) {
@@ -1362,6 +1362,7 @@ class UUIDColumn extends ColumnType {
1362
1362
  this,
1363
1363
  t,
1364
1364
  `uuid()`,
1365
+ // don't output the default default
1365
1366
  data.default instanceof orchidCore.RawSQLBase && data.default._sql === uuidDefaultSQL ? __spreadProps$7(__spreadValues$c({}, data), { default: void 0 }) : data
1366
1367
  );
1367
1368
  }
@@ -1559,7 +1560,9 @@ class JSONColumn extends ColumnType {
1559
1560
  }
1560
1561
  toCode(t) {
1561
1562
  const { schema } = this.data;
1562
- return columnCode(this, t, `json((t) => ${schema.toCode("t")})`);
1563
+ const schemaCode = orchidCore.toArray(schema.toCode(t));
1564
+ orchidCore.addCode(schemaCode, ",");
1565
+ return columnCode(this, t, [`json((${t}) =>`, schemaCode, ")"]);
1563
1566
  }
1564
1567
  }
1565
1568
  class JSONTextColumn extends ColumnType {