You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using .array() within a postgres schema, the PgTransaction type with ExtractTablesWithRelations now throws an error when it didn't previously in 0.27.x.
import{pgTable,uuid,varchar,}from'drizzle-orm/pg-core';importtype{PgTransaction}from'drizzle-orm/pg-core';importtype{NeonQueryResultHKT}from'drizzle-orm/neon-serverless';importtype{ExtractTablesWithRelations}from'drizzle-orm';exportconsttable1=pgTable('test',{id: uuid('id').defaultRandom().primaryKey(),username: varchar('username',{length: 64,}).notNull(),array_field: varchar('array_field',{length: 64,}).array(),});constschema={
table1,};typeExtractedRelations=ExtractTablesWithRelations<typeofschema>;// errors as below. Works perfectly if you comment out the above `array_field` fieldtypeDBTransaction=PgTransaction<NeonQueryResultHKT,typeofschema,ExtractedRelations>;
Errors with:
Type 'ExtractTablesWithRelations<{ table1: PgTableWithColumns<{ name: "test"; schema: undefined; columns: { id: PgColumn<{ name: "id"; tableName: "test"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; usern...' does not satisfy the constraint 'TablesRelationalConfig'.
Property 'table1' is incompatible with index signature.
Type '{ tsName: "table1"; dbName: "test"; columns: { id: PgColumn<{ name: "id"; tableName: "test"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; username: PgColumn<...>; array_field: PgColumn<...>; }; rela...' is not assignable to type 'TableRelationalConfig'.
Types of property 'columns' are incompatible.
Type '{ id: PgColumn<{ name: "id"; tableName: "test"; dataType: "string"; columnType: "PgUUID"; data: string; driverParam: string; notNull: true; hasDefault: true; enumValues: undefined; baseColumn: never; }, {}, {}>; username: PgColumn<...>; array_field: PgColumn<...>; }' is not assignable to type 'Record<string, AnyColumn>'.
Property 'array_field' is incompatible with index signature.
Type 'PgColumn<{ name: "array_field"; tableName: "test"; dataType: "array"; columnType: "PgArray"; data: string[]; driverParam: string | string[]; notNull: false; hasDefault: false; enumValues: [string, ...string[]]; baseColumn: Column<...>; }, {}, {}>' is not assignable to type 'AnyColumn'.
Types of property '_' are incompatible.
Type 'ColumnTypeConfig<{ name: "array_field"; tableName: "test"; dataType: "array"; columnType: "PgArray"; data: string[]; driverParam: string | string[]; notNull: false; hasDefault: false; enumValues: [string, ...string[]]; baseColumn: Column<...>; }, { ...; }>' is not assignable to type 'ColumnTypeConfig<Required<{ data: unknown; name: string; dataType: ColumnDataType; columnType: string; driverParam: unknown; enumValues: string[] | undefined; tableName: string; notNull: boolean; hasDefault: boolean; }>, object>'.
Type 'ColumnTypeConfig<{ name: "array_field"; tableName: "test"; dataType: "array"; columnType: "PgArray"; data: string[]; driverParam: string | string[]; notNull: false; hasDefault: false; enumValues: [string, ...string[]]; baseColumn: Column<...>; }, { ...; }>' is not assignable to type '{ brand: "Column"; tableName: string; name: string; dataType: ColumnDataType; columnType: string; data: unknown; driverParam: unknown; notNull: boolean; hasDefault: boolean; enumValues: string[] | undefined; baseColumn: never; }'.
Types of property 'baseColumn' are incompatible.
Type 'Column<{ name: "array_field"; tableName: "test"; dataType: "string"; columnType: "PgVarchar"; data: string; driverParam: string; notNull: false; hasDefault: false; enumValues: [string, ...string[]]; baseColumn: never; }, object, object>' is not assignable to type 'never'.
Expected behavior
If I comment out the array_field everything works as expected, as well as if I downgrade to 0.27.2. The intent here is to pass around a tx: DBTransaction between functions for code separation, and worked well in 0.27.2.
Environment & setup
Node.js 18.17.0
The text was updated successfully, but these errors were encountered:
What version of
drizzle-orm
are you using?0.28.0
What version of
drizzle-kit
are you using?0.19.12
Describe the Bug
When using
.array()
within a postgres schema, thePgTransaction
type withExtractTablesWithRelations
now throws an error when it didn't previously in 0.27.x.Errors with:
Expected behavior
If I comment out the
array_field
everything works as expected, as well as if I downgrade to0.27.2
. The intent here is to pass around atx: DBTransaction
between functions for code separation, and worked well in0.27.2.
Environment & setup
Node.js 18.17.0
The text was updated successfully, but these errors were encountered: