lykahb / groundhog

This library maps datatypes to a relational model, in a way similar to what ORM libraries do in OOP. See the tutorial https://www.schoolofhaskell.com/user/lykahb/groundhog for introduction
http://hackage.haskell.org/package/groundhog
177 stars 39 forks source link

uuid AutoKey? #52

Open imalsogreg opened 8 years ago

imalsogreg commented 8 years ago

I like how TH-derived automatically incremented int keys free me from having to put any kind of primary key directly in my type, since often the key has nothing to do with my business logic, and sometimes I don't know what the key is until the database tells me.

Is it possible to get the same functionality but with V4 UUID's (if I commit myself to Postgres)? Or would I need to have an actual UUID field in my Haskell record if I want a UUID key?

lykahb commented 8 years ago

I think it will be a nice feature. I will see if there is a way to replace AutoKeyType used for the autoincremented keys with something more flexible. If the primary key can be defined with custom database type and a default, that would be sufficient for using UUID.

taylor1791 commented 8 years ago

Any progress or thoughts on this?

lykahb commented 8 years ago

Some parts of the architecture rely on the autoincremented key always having the type defined for the database in the type family AutoKeyType. Adding setting for the DB schema is only a half of the feature. I'll try to get back to this issue the next week.