+++ /dev/null
-package # hide from PAUSE
- MyFilm;
-
-use warnings;
-use strict;
-
-use base 'MyBase';
-use MyStarLink;
-
-__PACKAGE__->set_table();
-__PACKAGE__->columns(All => qw/filmid title/);
-__PACKAGE__->has_many(_stars => 'MyStarLink');
-__PACKAGE__->columns(Stringify => 'title');
-
-sub _carp { }
-
-sub stars { map $_->star, shift->_stars }
-
-sub create_sql {
- return qq{
- filmid TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- title VARCHAR(255)
- };
-}
-
-1;
-
+++ /dev/null
-package # hide from PAUSE
- MyStar;
-
-use warnings;
-use strict;
-
-use base 'MyBase';
-
-__PACKAGE__->set_table();
-__PACKAGE__->columns(All => qw/starid name/);
-__PACKAGE__->has_many(films => [ MyStarLink => 'film' ]);
-
-# sub films { map $_->film, shift->_films }
-
-sub create_sql {
- return qq{
- starid TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- name VARCHAR(255)
- };
-}
-
-1;
-
+++ /dev/null
-package # hide from PAUSE
- MyStarLink;
-
-use warnings;
-use strict;
-
-use base 'MyBase';
-
-__PACKAGE__->set_table();
-__PACKAGE__->columns(All => qw/linkid film star/);
-__PACKAGE__->has_a(film => 'MyFilm');
-__PACKAGE__->has_a(star => 'MyStar');
-
-sub create_sql {
- return qq{
- linkid TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
- film TINYINT NOT NULL,
- star TINYINT NOT NULL
- };
-}
-
-1;
-
+++ /dev/null
-package # hide from PAUSE
- MyStarLinkMCPK;
-
-use warnings;
-use strict;
-
-use base 'MyBase';
-
-use MyStar;
-use MyFilm;
-
-# This is a many-to-many mapping table that uses the two foreign keys
-# as its own primary key - there's no extra 'auto-inc' column here
-
-__PACKAGE__->set_table();
-__PACKAGE__->columns(Primary => qw/film star/);
-__PACKAGE__->columns(All => qw/film star/);
-__PACKAGE__->has_a(film => 'MyFilm');
-__PACKAGE__->has_a(star => 'MyStar');
-
-sub create_sql {
- return qq{
- film INTEGER NOT NULL,
- star INTEGER NOT NULL,
- PRIMARY KEY (film, star)
- };
-}
-
-1;
-
+++ /dev/null
-package # hide from PAUSE
- OtherFilm;
-
-use warnings;
-use strict;
-
-use base 'Film';
-
-__PACKAGE__->set_table('Different_Film');
-
-sub create_sql {
- return qq{
- title VARCHAR(255),
- director VARCHAR(80),
- codirector VARCHAR(80),
- rating CHAR(5),
- numexplodingsheep INTEGER,
- hasvomit CHAR(1)
- };
-}
-
-1;
-