© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
18 replies
psm

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
slug
column's default be determined based on
title
title
via a slugify function?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

how to set default null to an int column
Drizzle TeamDTDrizzle Team / help
3y ago
How to set a default timestamp_ms for sqlite
Drizzle TeamDTDrizzle Team / help
3y ago
How to set a GIN index on the JSONB column?
Drizzle TeamDTDrizzle Team / help
2y ago
how can i get column's default value in runtime?
Drizzle TeamDTDrizzle Team / help
3y ago