bonfire-networks / bonfire-app

Bonfire - tend to your digital life in community. Customise and host your own online space and control your experience at the most granular level.
https://bonfirenetworks.org
GNU Affero General Public License v3.0
522 stars 37 forks source link

Consider using prefixed UUIDv7 instead of ULID #941

Open mayel opened 1 week ago

mayel commented 1 week ago

Added an implementation here: https://github.com/bonfire-networks/needle_ulid/commit/f37d212c61848f0496375f302e5aa10814252dcb Using prefixed IDs would work well with our Needle/Pointer system as we could know what type/table an ID is from without having to query the Pointer table thus gaining performance, and it should also maybe make it possible to progressively transition from ULID to UUIDv7 while using a single Ecto Type module (by handling non-prefixed as ULID and prefixed as UUIDv7).

mayel commented 1 week ago

Other than the advantage of prefixing, the suggestion of using UUIDv7 simply because UUID is more common/supported than ULID, eg. postgres integration: https://news.ycombinator.com/item?id=39260614 and UUIDv7 provides the same advantages as the reasons we chose ULID over UUIDv4 (mostly the timestamp being built in so as to make them sortable)