victormesquita.
victormesquita.
DTDrizzle Team
Created by victormesquita. on 9/26/2023 in #help
Can't run drizzle-kit push:pg - error: column is in a primary key
Hi,
I get this error every time i run push:pg error: column "userId" is in a primary key at Parser.parseErrorMessage (/Users/victormesquita/Documents/Projects/MobiData/node_modules/drizzle-kit/index.cjs:40722:98) at Parser.handlePacket (/Users/victormesquita/Documents/Projects/MobiData/node_modules/drizzle-kit/index.cjs:40563:25) at Parser.parse (/Users/victormesquita/Documents/Projects/MobiData/node_modules/drizzle-kit/index.cjs:40487:34) at Socket.<anonymous> (/Users/victormesquita/Documents/Projects/MobiData/node_modules/drizzle-kit/index.cjs:40763:44) at Socket.emit (node:events:513:28) at addChunk (node:internal/streams/readable:324:12) at readableAddChunk (node:internal/streams/readable:297:9) at Readable.push (node:internal/streams/readable:234:10) at TCP.onStreamRead (node:internal/stream_base_commons:190:23) { length: 101, severity: 'ERROR', code: '42P16', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'tablecmds.c', line: '7327', routine: 'ATExecDropNotNull' }
13 replies
DTDrizzle Team
Created by victormesquita. on 9/1/2023 in #help
How drizzle handle nulls and undefineds ?
I'm running this query, but some values in where clause are undefined, how do i make it optional ? Error: UNDEFINED_VALUE: Undefined values are not allowed query:
async list(companyId: number, lineClassId: number | undefined): Promise<Line[]> {
const lines = await this.dbContext.dbset
.select()
.from(lineModel)
.where(
and(eq(lineModel.companyId, companyId), eq(lineModel.status, 'ativo'), eq(lineModel.lineClass, lineClassId)),
);

return lines.map((line) => new Line(line.id, line.lineNumber, line.visa, line.companyId));
}
async list(companyId: number, lineClassId: number | undefined): Promise<Line[]> {
const lines = await this.dbContext.dbset
.select()
.from(lineModel)
.where(
and(eq(lineModel.companyId, companyId), eq(lineModel.status, 'ativo'), eq(lineModel.lineClass, lineClassId)),
);

return lines.map((line) => new Line(line.id, line.lineNumber, line.visa, line.companyId));
}
4 replies
DTDrizzle Team
Created by victormesquita. on 9/1/2023 in #help
Relational queries result types are not working
10 replies