Afi
Afi
DTDrizzle Team
Created by JT on 3/14/2023 in #help
error: there is no transaction in progress
I just started using cockroachdb and encountered this issue, has the --strict mode been implemented? is there a workaround for this other than removing the DO $$ ?
8 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
ohh im missing the fourth scenario btw
28 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
in the three scenarios, the sql are gentting generated accordingly. Not sure if this would break tho
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where "flow"."workspaceId" = $1 order by "flow"."createdAt" desc limit $2',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', 10 ]
}
GET /interaction-flows?_data=routes%2Finteraction-flows._index 200 - - 12.110 ms
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where ("flow"."workspaceId" = $1 and "flow"."name" ilike $2) order by "flow"."createdAt" desc limit $3',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', '%onb%', 10 ]
}
GET /interaction-flows?name=onb&_data=root 200 - - 2.608 ms
GET /interaction-flows?name=onb&_data=routes%2Finteraction-flows._index 200 - - 5.796 ms
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where ("flow"."workspaceId" = $1 and "flow"."name" ilike $2 and "flow"."status" = $3) order by "flow"."createdAt" desc limit $4',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', '%onb%', 'DRAFT', 10 ]
}
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where "flow"."workspaceId" = $1 order by "flow"."createdAt" desc limit $2',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', 10 ]
}
GET /interaction-flows?_data=routes%2Finteraction-flows._index 200 - - 12.110 ms
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where ("flow"."workspaceId" = $1 and "flow"."name" ilike $2) order by "flow"."createdAt" desc limit $3',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', '%onb%', 10 ]
}
GET /interaction-flows?name=onb&_data=root 200 - - 2.608 ms
GET /interaction-flows?name=onb&_data=routes%2Finteraction-flows._index 200 - - 5.796 ms
{
sql: 'select "id", "name", "status", "workspaceId", "flowFilter", "triggerFilter", "createdAt" from "flow" where ("flow"."workspaceId" = $1 and "flow"."name" ilike $2 and "flow"."status" = $3) order by "flow"."createdAt" desc limit $4',
params: [ '0b89b583-6714-4c24-be19-70f3a358a60b', '%onb%', 'DRAFT', 10 ]
}
28 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
even if there is only a single value in and operator, it still works
28 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
this works for me for now,
const queries = [eq(flowEntity.workspaceId, workspaceId)];

if (flowName) {
queries.push(ilike(flowEntity.name, `%${flowName}%`));
}
if (status) {
queries.push(eq(flowEntity.status, status));
}

const flows = db
.select()
.from(flowEntity)
.where(and(...queries));
if (limit) {
flows.limit(limit);
}
const result = flows.orderBy(desc(flowEntity.createdAt)).offset(offset);
return await result;
const queries = [eq(flowEntity.workspaceId, workspaceId)];

if (flowName) {
queries.push(ilike(flowEntity.name, `%${flowName}%`));
}
if (status) {
queries.push(eq(flowEntity.status, status));
}

const flows = db
.select()
.from(flowEntity)
.where(and(...queries));
if (limit) {
flows.limit(limit);
}
const result = flows.orderBy(desc(flowEntity.createdAt)).offset(offset);
return await result;
28 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
does anybody have an utils lib for this?
28 replies
DTDrizzle Team
Created by JT on 3/16/2023 in #help
.andWhere()
im having a hard time migrating from typeorm without an andWhere
28 replies