Commit | Line | Data |
---|---|---|
18fca96a | 1 | package DBIx::Class::Schema::Loader::Writing; |
a78e3fed | 2 | |
3 | # Empty. POD only. | |
4 | ||
5 | 1; | |
6 | ||
7 | =head1 NAME | |
8 | ||
18fca96a | 9 | DBIx::Class::Schema::Loader::Writing - Loader subclass writing guide |
a78e3fed | 10 | |
11 | =head1 SYNOPSIS | |
12 | ||
18fca96a | 13 | package DBIx::Class::Schema::Loader::Foo; |
a78e3fed | 14 | |
15 | # THIS IS JUST A TEMPLATE TO GET YOU STARTED. | |
16 | ||
17 | use strict; | |
18fca96a | 18 | use base 'DBIx::Class::Schema::Loader::Generic'; |
a78e3fed | 19 | use Carp; |
20 | ||
3385ac62 | 21 | sub _loader_db_classes { |
a78e3fed | 22 | return qw/DBIx::Class::PK::Auto::Foo/; |
23 | # You may want to return more, or less, than this. | |
24 | } | |
25 | ||
3385ac62 | 26 | sub _loader_tables { |
fbd83464 | 27 | my $class = shift; |
28 | my $dbh = $class->storage->dbh; | |
a78e3fed | 29 | return $dbh->tables; # Your DBD may need something different |
30 | } | |
31 | ||
3385ac62 | 32 | sub _loader_table_info { |
fbd83464 | 33 | my ( $class, $table ) = @_; |
a78e3fed | 34 | ... |
35 | return ( \@cols, \@primary ); | |
36 | } | |
37 | ||
3385ac62 | 38 | sub _loader_relationships { |
fbd83464 | 39 | my $class = shift; |
a78e3fed | 40 | ... |
3385ac62 | 41 | $class->_loader_make_relations($table, $f_key, $f_table, $f_column); |
a78e3fed | 42 | # For each relationship you want to set up ($f_column is |
43 | # optional, default is $f_table's primary key) | |
44 | ... | |
45 | } | |
46 | ||
47 | =cut |