added kwalitee test
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / Writing.pm
1 package DBIx::Class::Schema::Loader::Writing;
2 use strict;
3
4 # Empty. POD only.
5
6 1;
7
8 =head1 NAME                                                                     
9                                                                                 
10 DBIx::Class::Schema::Loader::Writing - Loader subclass writing guide
11
12 =head1 SYNOPSIS
13
14   package DBIx::Class::Schema::Loader::Foo;
15
16   # THIS IS JUST A TEMPLATE TO GET YOU STARTED.
17
18   use strict;
19   use warnings;
20   use base 'DBIx::Class::Schema::Loader::Generic';
21   use Class::C3;
22
23   sub _db_classes {
24       return qw/PK::Auto::Foo/;
25           # You may want to return more, or less, than this.
26   }
27
28   sub _tables {
29       my $self = shift;
30       my $dbh = $self->schema->storage->dbh;
31       return $dbh->tables; # Your DBD may need something different
32   }
33
34   sub _table_info {
35       my ( $self, $table ) = @_;
36       ...
37       return ( \@cols, \@primary );
38   }
39
40   sub _load_relationships {
41       my $self = shift;
42       ...
43
44       # make a simple relationship, where $table($column)
45       #  references the PK of $f_table:
46       $self->_make_simple_rel($table, $f_table, $column);
47
48       # make a relationship with a complex condition-clause:
49       $self->_make_cond_rel($table, $f_table,
50           { foo => bar, baz => xaa } );
51
52       ...
53   }
54
55   1;
56
57 =cut