Schema::Loader converted to better inheritance model, no longer pollutes user schema...
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Writing.pm
CommitLineData
18fca96a 1package DBIx::Class::Schema::Loader::Writing;
a78e3fed 2
3# Empty. POD only.
4
51;
6
7=head1 NAME
8
18fca96a 9DBIx::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;
3980d69c 18 use warnings;
18fca96a 19 use base 'DBIx::Class::Schema::Loader::Generic';
a78e3fed 20
3980d69c 21 sub _db_classes {
a78e3fed 22 return qw/DBIx::Class::PK::Auto::Foo/;
23 # You may want to return more, or less, than this.
24 }
25
3980d69c 26 sub _tables {
27 my $self = shift;
28 my $dbh = $self->schema->storage->dbh;
a78e3fed 29 return $dbh->tables; # Your DBD may need something different
30 }
31
3980d69c 32 sub _table_info {
33 my ( $self, $table ) = @_;
a78e3fed 34 ...
35 return ( \@cols, \@primary );
36 }
37
3980d69c 38 sub _load_relationships {
39 my $self = shift;
a78e3fed 40 ...
3980d69c 41
42 # make a simple relationship, where $table($column)
43 # references the PK of $f_table:
44 $self->_make_simple_rel($table, $f_table, $column);
45
46 # make a relationship with a complex condition-clause:
47 $self->_make_cond_rel($table, $f_table,
48 { foo => bar, baz => xaa } );
49
a78e3fed 50 ...
51 }
52
53=cut