samsondav / rihanna

Rihanna is a high performance postgres-backed job queue for Elixir
MIT License
439 stars 49 forks source link

Binary primary key #8

Closed lleger closed 6 years ago

lleger commented 6 years ago

It looks like the migration is hard-coded to use an integer primary key. Is it possible to use a binary, such as PG's built-in support for UUID primary keys?

samsondav commented 6 years ago

@lleger thanks for opening an issue!

Yes, the migration uses integer primary keys. Can I ask why you would prefer a UUID?

lleger commented 6 years ago

We use UUIDs as primary keys by default, so it would be nice to have all of the tables in the database use them consistently. If we add Rihanna, she would be the only table with a non-UUID primary key.

samsondav commented 6 years ago

It is not currently possible to customise the primary key in Rihanna.

I'm not sure I see any clear benefit to having the ID be a UUID other than consistency for consistency's sake in your case. It would come at a cost of some extra code complexity (and an extremely tiny performance hit) and would also interfere with the default sorting order - Rihanna finds the oldest job by sorting by (id, enqueued_at).

Unless there is some clear reason to do so I think I'd have to say I won't be able to support this.

You are welcome to fork the library and modify it yourself though :)