Re: [RDBO] One-to-One on unique key

2007-05-18 Thread Derek Watson
That's a pretty cool approach, and it solves adding a new record smoothly. But what it misses is the ability to fetch all a that have a non-archived b: SELECT * FROM a JOIN b ON (b.a_id=a.id) WHERE b.archived_at IS NULL or My::A::Manager->get_as_iterator(requre_objects => [ 'b' ]); Here's another

Re: [RDBO] One-to-One on unique key

2007-05-18 Thread John Siracusa
On 5/18/07, Derek Watson <[EMAIL PROTECTED]> wrote: > Am I modeling this wrong? How can I get Rose to archive the previous > $a->b when I say $a->b($new_b_record)? Or at least try to save the new > 'b' record so that my DB will throw an error about a clashing unique > key? A ...-to-one expects the

[RDBO] One-to-One on unique key

2007-05-18 Thread Derek Watson
Hello all, Please help me get this working right in Rose, CREATE TABLE a ( id serial primary key, name text ); CREATE TABLE b ( id serial primary key, a_id integer, archived_at timestamp UNIQUE KEY (a_id, archived_at) ); What I am trying to express here is that "a" is related to man