Extend/omit from table schema.

Let's say I have this schema.
export const users = pgTable('users', {
id: serial('id').primaryKey(),
email: varchar('email', { length: 255 }).notNull().unique(),
phone: varchar('phone', { length: 30 }).notNull().unique(),
userName: varchar('user_name', { length: 255 }).notNull(),
firstName: varchar('first_name', { length: 255 }).notNull(),
lastName: varchar('last_name', { length: 255 }).notNull(),
bio: text('bio'),
password: varchar('password', { length: 255 }).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
export const users = pgTable('users', {
id: serial('id').primaryKey(),
email: varchar('email', { length: 255 }).notNull().unique(),
phone: varchar('phone', { length: 30 }).notNull().unique(),
userName: varchar('user_name', { length: 255 }).notNull(),
firstName: varchar('first_name', { length: 255 }).notNull(),
lastName: varchar('last_name', { length: 255 }).notNull(),
bio: text('bio'),
password: varchar('password', { length: 255 }).notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
updatedAt: timestamp('updated_at').defaultNow().notNull(),
});
is there a way to create a copy the schema without password column?
1 Reply
DoggeSlapper
DoggeSlapperOP2mo ago
only solution so far is have the columns object as another variable and create both tables form that
Want results from more Discord servers?
Add your server