Nanoid implementation in PostgreSQL PL/pgSQL
- Postgres with pgcrypto
Run the SQL file, or include the function in your database migrations
Use as the default value for your id columns!
CREATE TABLE users (
"id" char(21) NOT NULL DEFAULT nanoid(),
...
)
- Function that takes a custom alphabet