Jakeii / nanoid-postgres

Nanoid implementation in PostgreSQL PL/pgSQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nanoid-postgres

Nanoid implementation in PostgreSQL PL/pgSQL

Requirements

  • Postgres with pgcrypto

Usage

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(),
  ...
)

Todo

  • Function that takes a custom alphabet

About

Nanoid implementation in PostgreSQL PL/pgSQL

License:MIT License


Languages

Language:PLpgSQL 100.0%