defmodule FeedPug.Schema do
@moduledoc """
Base schema for FeedPug: UUIDv7 (time-ordered) binary primary keys with
binary foreign keys. `use FeedPug.Schema` in place of `use Ecto.Schema`.
Primary keys are autogenerated app-side as UUIDv7, so they sort by creation
time — good index locality without leaking a sequential counter.
"""
defmacro __using__(_opts) do
quote do
use Ecto.Schema
@primary_key {:id, UUIDv7, autogenerate: true}
@foreign_key_type :binary_id
end
end
end
neiam
/feedpug
feedpub
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
521 B · text
History
6d24830