How to set a default value for column based on another column?

For example, if I had this schema:
export const posts = sqliteTable({
  id: integer("id").primaryKey(),
  title: text("title"),
  slug: text("slug").default(/* ??? */),
});

How could I make the slug column's default be determined based on title via a slugify function?
Was this page helpful?