Replies: 1 comment
-
you can use a custom type, it works fine as long as you don't need to use relations const snowflake = customType<{
data: string;
}>({
dataType() {
return 'bigint';
},
// @ts-expect-error
fromDriver(value: string) {
return value.toString();
},
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello everyone!
I am recently working on a project that involves using discord ids (snowflakes) as primary keys.
So that everything works fast, I decided to go with the bigint of postgresql. It will be sufficient until like 2064 or something until discord's snowflakes reach the cap, because they are normally unsigned integers and bigint is a signed one. Anways.
Is it possible to set the "mode" of the bigint to a string? libraries like discord.js parse userids as strings.
It would make my job much easier as I wont have to parse the string to a bigint everytime when I am e.g. doing
eq(users.id, BigInt(authUser.id))
Beta Was this translation helpful? Give feedback.
All reactions