CaptainFantastic
DTDrizzle Team
•Created by CaptainFantastic on 10/11/2024 in #help
Extremely weird behaviour
Apologies for the lack of better title.
I have come across a weird behaviour where select().from(tablename) returns old and stale data.
import { db } from "@/db/drizzle";
updateCompany({ name: "NAME 1", companyId: 50 })
updateCompany({ name: "NAME 2", companyId: 51 })
updateCompany({ name: "NAME 3", companyId: 52 })
const companies = await db.select().from(companiesTable);
console.log("companies are:", companies);
updateCompany code:
import { db } from "@/db/drizzle";
export async function updateCompany(data: any) {
const companyData = {
...data,
updatedAt: new Date(),
};
const company = await db
.update(companiesTable)
.set(companyData)
.where(eq(companiesTable.companyId, data.companyId))
.returning();
return company[0];
}
You'd expect that returned companies to be NAME 1,..., NAME 3 but I'm getting the old values no matter what I do. The new values are reflected in the database when I check through drizzle-studio and I check NEON db table which means my updateCompany is working but the returned value is incorrect.
I ran out of ideas to troubleshoot. What could I be doing wrong? And what can I do to troubleshoot this further?10 replies
DTDrizzle Team
•Created by CaptainFantastic on 8/13/2024 in #help
Error using drizzle-kit studio
I started encountering this issue out of the blue today without having changed any bit of the code (As far as I remember)
Error: The result contains the unsupported data type "CHAR".
There seems to be an open bug https://github.com/drizzle-team/drizzle-kit-mirror/issues/542.
Anyone know what could have caused this? And how come this started happening all of a sudden? I don't believe we have updated anything4 replies