<br><br><div><span class="gmail_quote">On 8/1/06, <b class="gmail_sendername">Anthony Gardner</b> <<a href="mailto:cyclewood_ltd@yahoo.co.uk">cyclewood_ltd@yahoo.co.uk</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>I'm a newbie to ORM and DBIx::Class and I think my question will be bread and butter for you guys but I can't figure it out so don't flame me!!</div></blockquote><div><br><br>This may not completely answer your questions, but it might move you in the right directions:
<br><br>1) On the many to many table design: The "school_attendees" table doesn't need its own "id" primary key field. It can (and arguably *should*) be built as:<br><br></div> CREATE TABLE school_attendees
(<br> attendee_id INTEGER NOT NULL REFERENCES students(id),<br> school_id INTEGER NOT NULL REFERENCES schools(id),<br> PRIMARY KEY(attendee_id, school_id)<br> );</div><br>2) In DB::MyTestSchema::School, you have the load_components arguments backwards. Its PK::Auto first, then Core, like you have it in the other ones (order matters).
<br><br>3) See <a href="http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Many-to-many_relationships">http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Many-to-many_relationships
</a> for example of how to construct a many-to-many relationship helper on top of the two underlying one-to-many relationships you've built.<br><br>-- Brandon<br>