I'm interested in using UUIDs instead of integer for primary keys in some of
my models and I'm not sure what would be the best way to implement it in
Sequel. I'm thinking something like this:
class ExampleMigration < Sequel::Migration

  def up
    create_table(:examples) do
      String   :id, :size => 36, :unique => true
      String   :name
      DateTime :created_at
      DateTime :updated_at
    end
  end

  def down
    drop_table :examples
  end

end

class Example < Sequel::Model

  def before_create
    super
    self[:id] = CustomUUID.generate
  end

end

What would you do differently and why? Is there any possible problems with
this type of primary key? Any comments would be appreciated but please be
gentle ;-)

Thanks in advance,


Adrian Madrid
My eBiz, Developer
3082 W. Maple Loop Dr
Lehi, UT 84043
801-341-3824

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to