Using Uuidv7 with Ruby on Rails Without Postgresql 18
Postedabout 2 months agoActiveabout 2 months ago
t27duck.comTechstory
calmpositive
Debate
20/100
Uuidv7Ruby on RailsDatabase Migration
Key topics
Uuidv7
Ruby on Rails
Database Migration
The article discusses implementing UUIDv7 in Ruby on Rails without PostgreSQL 18, and the discussion revolves around different approaches to achieve this.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
N/A
Peak period
2
0-1h
Avg / period
1.5
Key moments
- 01Story posted
Nov 9, 2025 at 9:16 AM EST
about 2 months ago
Step 01 - 02First comment
Nov 9, 2025 at 9:16 AM EST
0s after posting
Step 02 - 03Peak activity
2 comments in 0-1h
Hottest window of the conversation
Step 03 - 04Latest activity
Nov 9, 2025 at 10:26 AM EST
about 2 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
Discussion (3 comments)
Showing 3 comments
FBISurveillance
about 2 months ago
1 replyAnother option is to use `SecureRandom.uuid_v7` like this:
This also gives you the advantage of having your PK known before record persisted (maybe it's just me but I like my UUID PKs generated in app instead of db)
t27duckAuthor
about 2 months ago
The big drawback is if your app also uses bulk sql inserts which bypasses model hooks. By letting the database handle it, all cases are covered.
t27duckAuthor
about 2 months ago
The app I work on at my day job uses UUIDs for primary keys. I'm not sure when/if an upgrade to PostgreSQL 18 will happen, but we wanted to take advantage of timestamp-based UUIDv7. Turns out, it's relatively easy to implement in current Rails with PostgreSQL < 18.
View full discussion on Hacker News
ID: 45865750Type: storyLast synced: 11/17/2025, 5:58:11 AM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.