I'm using Prisma as my ORM and PostgreSQL as my database, so this question applies both to Prisma and Postgres, and I have the following prisma schema:
model Employee {
id String @id @default(uuid())
registrationNumber String @db.VarChar @map("registration_number") @unique
fullName String @db.VarChar @map("full_name")
username String? @db.VarChar @map("username")
email String? @db.VarChar @map("email")
isSapUser Boolean @db.Boolean @map("is_sap_user") @default(false)
@@map("employee")
}
My question is: Should I set a size to my varchar, like @db.VarChar(20)? If I do set a size, does the database allocate more space? If I don't, does the database uses only what each field occupies?