I'm trying to port some app infrastructure from an old ad-hoc system
over to Sequel, and have hit a couple of issues with the class table
inheritance plugin and the schema generator. The goal is a CTI
structured database with UUID primary keys, where the parent object
type doesn't have to know what's inheriting from it.

So, first, is there any way of specifying a foreign_key that's neither
an integer nor a composite key? At the moment I'm using the composite
foreign key syntax but specifying only the single UUID column :id in
the keys array - this appears to work but seems a bit unpleasant.

With the CTI plugin, do the child classes need to be specified in the
table map? I'd rather not have to push knowledge about the class
hierarchy up into the top level class.

Finally, I can't work out how to inherit from my base object type when
my classes are namespaced and I have custom table names. I have

module ACS
  class Object < Sequel::Model(:acs_objects)
    plugin :class_table_inheritance, :key => :kind
    plugin :timestamps

    def before_create
      self.id = UUIDTools::UUID.random_create
    end
  end
end

If I try to define a subclass like so -

module ACS
  module Media
    class File < ACS::Object(:acs_media_files)
    end
  end
end

I get "NoMethodError: undefined method `Object' for ACS:Module" (which
makes sense, since ACS::Object isn't a method, though the PoLS
suggests it should work). If I do this instead -

module ACS
  module Media
    class File < ACS::Object
      set_dataset :acs_media_files
    end
  end
end

I get a trace back through the sqlite adapter with
"Sequel::DatabaseError: SQLite3::SQLException: no such table: files".
Is there a way to specify a custom table name for CTI subclasses?


cheers

Russell

-- 
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