psm
psm
Explore posts from servers
DTDrizzle Team
Created by psm on 9/27/2023 in #help
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(/* ??? */),
});
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?
19 replies