release 0.07008
[dbsrgits/DBIx-Class-Schema-Loader.git] / lib / DBIx / Class / Schema / Loader / DBI / Writing.pm
CommitLineData
996be9ee 1package DBIx::Class::Schema::Loader::DBI::Writing;
2use strict;
3
3bdcf490 4our $VERSION = '0.07008';
32f784fc 5
996be9ee 6# Empty. POD only.
7
996be9ee 8=head1 NAME
9
10DBIx::Class::Schema::Loader::DBI::Writing - Loader subclass writing guide for DBI
11
12=head1 SYNOPSIS
13
14 package DBIx::Class::Schema::Loader::DBI::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::DBI';
fa994d3c 21 use Carp::Clan qw/^DBIx::Class/;
942bd5e0 22 use mro 'c3';
996be9ee 23
24 sub _table_uniq_info {
25 my ($self, $table) = @_;
26
27 # ... get UNIQUE info for $table somehow
28 # and return a data structure that looks like this:
29
30 return [
31 [ 'keyname' => [ 'colname' ] ],
32 [ 'keyname2' => [ 'col1name', 'col2name' ] ],
33 [ 'keyname3' => [ 'colname' ] ],
34 ];
35
36 # Where the "keyname"'s are just unique identifiers, such as the
37 # name of the unique constraint, or the names of the columns involved
38 # concatenated if you wish.
39 }
40
fbcfebdd 41 sub _table_comment {
42 my ( $self, $table ) = @_;
43 return 'Comment';
44 }
45
46 sub _column_comment {
47 my ( $self, $table, $column_number ) = @_;
48 return 'Col. comment';
49 }
50
996be9ee 51 1;
52
53=head1 DETAILS
54
55The only required method for new subclasses is C<_table_uniq_info>,
25328cc4 56as there is not (yet) any standardized, DBD-agnostic way for obtaining
57this information from DBI.
996be9ee 58
59The base DBI Loader contains generic methods that *should* work for
60everything else in theory, although in practice some DBDs need to
61override one or more of the other methods. The other methods one might
b15c5735 62likely want to override are: C<_table_pk_info>, C<_table_fk_info>,
63C<_tables_list> and C<_extra_column_info>. See the included DBD drivers
64for examples of these.
996be9ee 65
be80bba7 66=head1 AUTHOR
67
9cc8e7e1 68See L<DBIx::Class::Schema::Loader/AUTHOR> and L<DBIx::Class::Schema::Loader/CONTRIBUTORS>.
be80bba7 69
70=head1 LICENSE
71
72This library is free software; you can redistribute it and/or modify it under
73the same terms as Perl itself.
74
fbcfebdd 75To import comments from database you need to implement C<_table_comment>,
76C<_column_comment>
77
996be9ee 78=cut
79
801;