#568 ✓resolved
Paul Dlug

[PATCH] UUID type for dm-types

Reported by Paul Dlug | September 19th, 2008 @ 08:24 PM

Attached is a patch to add a new type to dm-types to represent UUID's. This provides an alternative to serial primary keys (which are not feasible in many environments or database backing stores). The current type basically provides a shortcut to set a String field (size 36) with a default value.

property :id, UUID, :key => true, :unique_index => true, :nullable => false

I'd like some feedback on whether or not it is worth providing a UUID type to marshal/unmarshal to the UUID objects themselves vs. providing a "UUID Key" type.

Comments and changes to this ticket

  • Paul Sadauskas (Rando)

    Paul Sadauskas (Rando) September 19th, 2008 @ 11:39 PM

    Ruby has a uuid gem that would probably make more sense to use, rather than strings. Principle of least surprise, and all that.

    I have a UUID-type that I made for myself available here: http://github.com/paul/dm-adapte... . I guess I never got around to uploading it to dm-types. We should maybe merge what we have.

  • Paul Dlug

    Paul Dlug September 19th, 2008 @ 11:42 PM

    The patch actually uses the gem uuidtools to do the generation of the UUID. This could be exposed rather than as a string. It my quick comparison it looked like uuidtools was a better choice than uuid since it has a variety of generation techniques and doesn't create a cache file.

  • Paul Dlug

    Paul Dlug September 19th, 2008 @ 11:45 PM

    I see what you did in your patch, I actually have the same thing in another file but the patch I attached is for generating a UUID primary key which requires the default to be set. I'm not sure if it's possible to merge all of this functionality together or if there would need to be separate UUID/UUIDKey types (do default blocks have access to the property information?)

  • Jonas

    Jonas September 25th, 2008 @ 11:25 AM

    • Tag changed from dm-more, patch, types to dm-more, patch, postgresql, types

    UUID could be added of native way to PostgreSQL [1] adapter here [2].

    [1] http://www.postgresql.org/docs/8...

    [2] http://github.com/sam/dm-core/tr...

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 12:35 AM

    • Tag changed from dm-more, patch, postgresql, types to dm-more, patch, postgresql, types
    • State changed from “new” to “hold”
    • Title changed from “[Patch]: UUID type for dm-types” to “[PATCH] UUID type for dm-types”
    • Assigned user cleared.

    Paul (Dlug), I just wanted to follow up with you to see what the status of this ticket is. Should this be kept open? I thought there was already a UUID type added by Rando (the other Paul watching this ticket) to dm-types that does basically the same thing.

  • Paul Dlug

    Paul Dlug December 2nd, 2008 @ 10:38 AM

    This ticket can be closed, the current UUID implementation accomplishes what my patch did.

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) December 2nd, 2008 @ 03:28 PM

    • State changed from “hold” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Attachments

Pages