Nested Schema, Helper Functions
Hi, I am new to Drizzle.
1. I have the following User schema and I was wondering is there any way for combining some columns in one type, in this case I want to merge all profile fields into one type.
const User = pgSchema(configService.postgres.schema).table('users', {
id: uuid('id').default(sql
gen_random_uuid()
).primaryKey(),
email: varchar('email', { length: 255 }).notNull(),
password: varchar('password', { length: 255 }),
profileName: varchar('profile_name', { length: 255 }).default(''),
profileLastName: varchar('profile_last_name', { length: 255 }),
profileLocation: varchar('profile_location', { length: 255 }),
profileWebsite: varchar('profile_website', { length: 255 }),
profilePicture: text('profilePicture'),
});
2. Additionally, I would like to know if there's a way to add helper functions to the schemas? For example I want to have a getFullName() function which will return the combined name and lastName.0 Replies