</div>
<div class="slide">
- <pre>Example of a DBIC Result</pre>
+<pre>package MyApp::Schema::Result::Author;
+use strict; use warnings;
+__PACKAGE__->table('authors');
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'int',
+ size => 8,
+ },
+ title => {
+ data_type => 'varchar',
+ is_nullable => 1,
+ size => 255,
+ },
+);
+__PACKAGE__->set_primary_key('id');
+__PACKAGE__->has_many( books =>
+ 'MyApp::Schema::Result::Book', 'author_id'
+);
+1;
+</pre>
</div>
<div class="slide">
- <pre>Example of a DBIC Result</pre>
+<pre>package MyApp::Schema::Result::Book;
+use strict; use warnings;
+__PACKAGE__->table('books');
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'int',
+ size => 8,
+ },
+ name => {
+ data_type => 'varchar',
+ is_nullable => 1,
+ size => 255,
+ },
+ author_id => {
+ data_type => 'int',
+ size => 8,
+ is_nullable => 1, # <-- probably should be 0
+ },
+);
+__PACKAGE__->set_primary_key('id');
+__PACKAGE__->belongs_to( author =>
+ 'MyApp::Schema::Result::Author', 'author_id'
+);
+1;
+</pre>
</div>
<div class="slide">