How do I extract a shared "Schema" that is used across several tables?

I want to have a construct like this:
export const auditAware: ????? = {
createdAt: date('created_at').notNull(),
updatedAt: date('updated_at').notNull(),
updatedBy: text('updated_by').notNull().references(() => user.id),
};
export const auditAware: ????? = {
createdAt: date('created_at').notNull(),
updatedAt: date('updated_at').notNull(),
updatedBy: text('updated_by').notNull().references(() => user.id),
};
Then just spread the props unto the tables. The question is how do I spread the ????? bit.
2 Replies
Angelelz
Angelelz14mo ago
You don't need to give it a type, take a look at this answer https://discord.com/channels/1043890932593987624/1156106771753087048/1156226642641961100
Berzerker
BerzerkerOP14mo ago
Thank you!
Want results from more Discord servers?
Add your server