[Nitro] [ANN] Nitro + Og 0.22.0

Dimitri Aivaliotis aglarond at gmail.com
Wed Aug 10 03:33:54 EDT 2005


Hi George,

I'm having a problem importing the structure from a legacy MySQL DB
into a PostgreSQL one.
The problem is with the pre-defined 'oid' field: in MySQL it's
'auto_increment' and in PostgreSQL it's 'serial'. Is there an elegant
way to convert the values?

On 8/9/05, Robert Wagner <robbie.wilhelm at gmail.com> wrote:

> store/psql:
> 
>   def enchant(klass, manager)

> 
>     if klass.metadata.primary_key.flatten.first == :oid
>       unless klass.properties.find { |p| p.symbol == :oid }
>         klass.property :oid, Fixnum, :sql => 'serial PRIMARY KEY'
>       end
>     end
>     super
>   end

Or, do I need to comment-out the 'unless' clause (leaving, of course,
the klass.property assignment)? I.e., is there a really good reason to
preserve any pre-defined oid definition?

Thanks,

- Dimitri




More information about the Nitro-general mailing list