[jifty-devel] Regarding refers_to and by on JDBI columns

Andrew Sterling Hanenkamp sterling at hanenkamp.com
Sat Jul 14 11:19:00 EDT 2007


I just found out that my intuition on how "by" works on columns is not
correct .However, after looking through the code, it seems that it
would be a decent idea to make the code work the way I expected. What
I expect to work is this:

package App::Model::Foo;
use Jifty::DBI::Schema;
use App::Record schema {
    column name => type is 'text';
    column bar => refers_to App::Model::Bar;
};

package App::Model::Bar;
use Jifty::DBI::Schema;
use App::Record schema {
    column name => type is 'text';
    column foo => refers_to App::Model::Foo by 'bar';
};

I had assumed that if you do this, you would end up with a schema like:

CREATE TABLE foos(id int, name text, bar int);
CREATE TABLE bars(id int, name text);

The "foo" column in App::Model::Bar would be a virtual column refering
back to the linked foo. However, this is not the case. The "by" is
completely ignored as far as I can tell.

Anyway, I was about to try patching this, but thought I'd ask if this
was a good idea before I did it since it could have unintended
repercussions.

Cheers,
Andrew


More information about the jifty-devel mailing list