[Nitro] composite primary key

Steven Lumos steven at lumos.us
Wed Aug 3 16:03:16 EDT 2005

George Moschovitis <george.moschovitis at gmail.com> writes:

> As I said to Tim, provide me with an example and propose an API for
> this an we can worki this in Og :)

I went and found the original post I was thinking of:
> * Support for fully customizable primary keys. You are no longer
> forced to use xxx_oid primary keys. Appart from the extra
> flexibility this feature provides, this is an essential step towards
> the planed 'reverse engineering' mode that will allow the use of
> existing schemas with Og.

I read "fully customizable" and "use of existing schemas" and thought
there was already a design for composite keys just waiting to be
implemented.  (Probably because that's what I need.)

I'm not very familiar with Og yet, but I guess here's a pseudo API
proposal / example:

class Document
  property :volume, String
  property :accession, String
  property :path, String

  set_primary_key :volume, :accession

  has_many :pages, Page

class Page
  property :volume, String
  property :accession, String
  property :page, Fixnum
  property :skew, Float
  property :rotation, String
  property :status, String

  set_primary_key :volume, :accession, :page

  belongs_to :document, Document

That's pretty close to a subset of my real situation.  I'm thinking
there is going to be a problem with schema creation.  Does Og
currently handle adding constraints to tables it creates?


More information about the Nitro-general mailing list