On Mon, Aug 13, 2012 at 01:55:41PM -0700, Chris Lloyd wrote:
> Aaron, as you mention it's pretty easy easy to do this already, but it's 
> off the beaten path. On 3.2.6 I've included the postgres_ext gem to handle 
> UUID types in Postgres correctly. Migrations/models are also 
> easy: https://gist.github.com/3344006

I'd rather we do creation like this:

  CREATE TABLE x ( 
    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), 
    y integer 
  ); 

Then a model with uuid primary keys should act the same as one using
auto incrementing keys.  IIRC, there is code in AR that depends on the
database generating the record's ID.  If the DB generated the uuid,
everything should Just Work(tm) (I think).

> So far everything works A-OK. It just seems as though it would be nicer 
> with some syntax in the migration. Perhaps `create_table(:foos, :id => 
> :uuid)`?

Can we just modify the migration code to use the above form of
CREATE TABLE?

-- 
Aaron Patterson
http://tenderlovemaking.com/

Attachment: pgpCpxgpUJRaL.pgp
Description: PGP signature

Reply via email to