Skip to content

extrapost/base62id

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Base62Id

Base62Id Ecto type

Usage

Create migration for id generation:

mix base62id.install

Migrate:

mix ecto.migrate

In migration:

create_if_not_exists table(:products, primary_key: false) do
  add :id, :bigint, primary_key: true, default: fragment("id_generator()")
  # ...
end

In model schema:

@primary_key {:id, Ecto.Base62Id, read_after_writes: true}