Re: One last Ruby question for tonight - Regarding UUID type

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: One last Ruby question for tonight - Regarding UUID type
Date: 2011-01-29 02:28:38
Message-ID: AANLkTimNTQPvNg2+HfNNsf6uceyAZ_tUhZr_Dc8K+536@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> My goal is to learn Ruby by porting one of my existing PG web
> applications over to Rails..  However, my existing data heavily relies
> on the UUID data type.  I've noticed when I create a new model with
> something like:
>
> guidtest name:string value:uuid
>
> And then do a rake:migrate, the CREATE TABLE that gets generated looks like:
>
> CREATE TABLE guidtests
> (
>  id serial NOT NULL,
>  "name" character varying(255),
>  created_at timestamp without time zone,
>  updated_at timestamp without time zone,
>  CONSTRAINT guidtests_pkey PRIMARY KEY (id)
> )
> ...
>
> In other words, it just ignores my "uuid" type.  However, the views
> and stuff do include this column so the page will crash when I load it
> since the column doesn't exist in the DB.
> Is there some special thing I have to do to use the uuid type in
> ActiveRecord?  Thanks!

Update: If I manually add the column in using pgAdmin (as a uuid type
of course), the program actually runs (I can create new rows and
display data).. So RoR does support this type (probably gets
marshalled as a string??) but I guess the ActiveRecord schema
generation stuff just doesn't support uuid. Hmmm.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Uwe Schroeder 2011-01-29 09:11:26 PG9.0 planner difference to 8.3 -> majorly bad performance
Previous Message Mike Christensen 2011-01-29 02:23:17 One last Ruby question for tonight - Regarding UUID type