The intention is something like: upsert a person with their employee number, but only if the person to update is in the same company as the person performing the update. (This is not a real example from my domain, but you get the idea.)
The issue is that, in the types for the person table, the employer_id column's update type is never (as its intended to be immutable). However, kysely only lets me refer to the column in the where clause based on its update type, so the query gives an error when it seems like it should be allowed.
Argument of type '"person.employerId"' is not assignable to parameter of type 'ReferenceExpression<OnConflictDatabase<{ person: { id: ColumnType<number, number, never>; employeeNumber: number; employerId: ColumnType<number, number, never>; }; }, "person">, OnConflictTables<...>>'
Hi, I have a query like:
The intention is something like: upsert a person with their employee number, but only if the person to update is in the same company as the person performing the update. (This is not a real example from my domain, but you get the idea.)
The issue is that, in the types for the person table, the
employer_id
column's update type isnever
(as its intended to be immutable). However, kysely only lets me refer to the column in thewhere
clause based on its update type, so the query gives an error when it seems like it should be allowed.Self-contained example:
Error is: