hisam
hisam
DTDrizzle Team
Created by Gyurmatag on 6/18/2023 in #help
.get() returning only one element
Can you try this instead:
const fetchedPosts = await db.select().from(posts).limit(limit).offset(offset);
const fetchedPosts = await db.select().from(posts).limit(limit).offset(offset);
Note: make sure you've installed the latest version 👍
19 replies
DTDrizzle Team
Created by JiriK9 on 6/12/2023 in #help
UUID insted of ID
I am not really sure what's your intention here. But SERIAL itself is a number. Quoting from the official docs: (https://dev.mysql.com/doc/refman/8.0/en/numeric-type-syntax.html#:~:text=SERIAL%20is%20an%20alias%20for,for%20NOT%20NULL%20AUTO_INCREMENT%20UNIQUE%20.)
SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
SERIAL is an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE.
If you want to use UUID, you can use varchar or any other string based type.
3 replies
DTDrizzle Team
Created by Vonyc on 6/16/2023 in #help
How to check if is not null
You can try to directly pass the SQL part:
await db.query.users.findFirst({ where: and(eq(users.name, 'test'), isNotNull(users.name)) });
await db.query.users.findFirst({ where: and(eq(users.name, 'test'), isNotNull(users.name)) });
Note: I am not sure why you want to check the users.name = 'test' while also checking if the users.name is not null. The first query should be enough (since test != null)
await db.query.users.findFirst({ where: eq(users.name, "test") });
await db.query.users.findFirst({ where: eq(users.name, "test") });
4 replies