ts is converted to a UNIX timestamp split into millisecond and sub-millisecond parts.
to_uuidv7()
Create a version 7 UUID from a Postgres timestamp
Since 2.23.0
Create a UUIDv7 object from a timestamp and random bits.