[Nitro] Og inheritance

Jon A. Lambert jlsysinc at alltel.net
Wed Sep 13 17:28:30 EDT 2006


Name collisions are a problem in OG inheritence.

Example:
-cut-
require 'og'

class A
  property   :foo, String
  schema_inheritance
end
class B < A
  property   :bar, String
end
class C < A
  property   :bar, Integer
end

Og.setup(
  :destroy => true,
  :store => :psql,
  :user => 'zzzzzzzz',
  :password => 'zzzzzzzz',
  :name => 'test',
  :evolve_schema => true
)

test-# \d oga
                                  Table "public.oga"
 Column |         Type          |                      Modifiers
--------+-----------------------+------------------------------------------------------
 ogtype | character varying(50) |
 foo    | text                  |
 oid    | integer               | not null default 
nextval('public.oga_oid_seq'::text)
 bar    | text                  |
Indexes:
    "oga_pkey" primary key, btree (oid)

-cut-

I wonder if one is better off not using schema_inheritance and instead
letting it create a table per class.

What are the pros and cons?

--
J. Lambert 



More information about the Nitro-general mailing list