Hi,

I'm wondering what ways other Sequel users have dealt with splitting tables
vertically and then using Sequel::Model? Either splitting for conceptual or
performance reasons.

For example, right now I have a project where four different types of
entity all share a core table (and I would say they are subtypes, not just
sharing common data/behaviour) but each have fields that are unique to
themselves so they have their own table for those. If I modelled them in
Ruby first then I'd get them to inherit from the core class, but since
Sequel::Model already takes up the available superclass slot, I create a
composite object and stick the classes in there. As a simple example:

class Employee < Sequel::Model(DB[:employees])
  #several associations here...
end

class Boss < Sequel::Model(DB[:bosses])
end

class Temp < Sequel::Model(DB[:temps])
end

class Composite
  attr_accessor :employee_instance
  attr_accessor :subclass_instance
end

This makes things a lot more fiddly, especially dealing with associations.

I've had a look through the plugins and extensions available, but didn't
see anything that would help (but perhaps I got distracted by thinking "oh,
that'd be useful" every other click:)  I'm considering other ways, (perhaps
some kind of module solution to wrap the core class and then include in
subclasses) but before I get too far down the road wanted to see what
others might have done. I suppose I could use single table inheritance and
forget about the partitions, but I'd like to see if I can use vertical
partitioning first.

Any advice/insight is much appreciated.

Regards,
Iain

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to