first functional commit of non-subclassed-style Schema::Loader
[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;
18fca96a 18 use base 'DBIx::Class::Schema::Loader::Generic';
a78e3fed 19 use DBI;
20 use Carp;
21
22 sub _db_classes {
23 return qw/DBIx::Class::PK::Auto::Foo/;
24 # You may want to return more, or less, than this.
25 }
26
27 sub _tables {
28 my $self = shift;
af6c2665 29 my $dbh = $self->{_storage}->dbh;
a78e3fed 30 return $dbh->tables; # Your DBD may need something different
31 }
32
33 sub _table_info {
34 my ( $self, $table ) = @_;
35 ...
36 return ( \@cols, \@primary );
37 }
38
39 sub _relationships {
40 my $self = shift;
41 ...
42 $self->_belongs_to_many($table, $f_key, $f_table, $f_column);
43 # For each relationship you want to set up ($f_column is
44 # optional, default is $f_table's primary key)
45 ...
46 }
47
48=cut