Why varchar instead of text in T3 postgres/Drizzle schema?
Hi! First question here so please be kind 🙏
I've started a new app with
create-t3-app
, with Next Auth, PostgreSQL and Drizzle ORM.
The starting schema[1] for auth and a post example uses varchar
all over the place.
So now I have a (potentially dumb) question: why is varchar()
used there instead of text
?
According to the official docs[2] there's no perf benefit, there's even a small cost for the length check.
I assume the original author may not see this but if anyone has any ideas that would be great!
(my current assumption is that this is a holdover from the mysql version)
[1] https://github.com/t3-oss/create-t3-app/blob/ed5f545e602a19b21888fac85dc848a5cb4fc330/cli/template/extras/src/server/db/schema-drizzle/with-auth-postgres.ts
[2] https://www.postgresql.org/docs/current/datatype-character.html#DATATYPE-CHARACTER0 Replies