View Source ShortUUID.Prefixed.Schema (ShortUUID v3.0.0)
A convenience macro for setting up Ecto schemas with prefixed ShortUUID primary keys.
usage
Usage
defmodule MyApp.User do
use ShortUUID.Prefixed.Schema, prefix: "usr"
schema "users" do
belongs_to :team, MyApp.Team
timestamps()
end
endThis is equivalent to:
defmodule MyApp.User do
use Ecto.Schema
@primary_key {:id, ShortUUID.Prefixed, prefix: "usr", autogenerate: true}
@foreign_key_type ShortUUID.Prefixed
schema "users" do
belongs_to :team, MyApp.Team
timestamps()
end
end