Skip to content

Instantly share code, notes, and snippets.

@0xdevalias
Last active January 8, 2025 04:15
Show Gist options
  • Save 0xdevalias/76419472a9d7ab98f022da8285a3aa2a to your computer and use it in GitHub Desktop.
Save 0xdevalias/76419472a9d7ab98f022da8285a3aa2a to your computer and use it in GitHub Desktop.
Explore methods for prefixing Prisma generated database record IDs by type

Explore methods for prefixing Prisma generated database record IDs by type

Table of Contents

Original Notes

Originally posted as an internal GitHub issue:

It can be useful for DB record IDs to include a prefix that represents their type. This is used by companies such as Stripe/etc, and improves developer experience, as well as providing other tangible benefits:

Currently Prisma doesn't support generating IDs with prefixes natively in their schema definitions:

See Also

My Other Related Deepdive Gist's and Projects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment