Release 0.07047
[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;
f8c2ca5e 3use warnings;
996be9ee 4
306bf770 5our $VERSION = '0.07047';
32f784fc 6
996be9ee 7# Empty. POD only.
8
494e0205 9=head1 NAME
10
996be9ee 11DBIx::Class::Schema::Loader::DBI::Writing - Loader subclass writing guide for DBI
12
13=head1 SYNOPSIS
14
494e0205 15 package DBIx::Class::Schema::Loader::DBI::Foo;
996be9ee 16
494e0205 17 # THIS IS JUST A TEMPLATE TO GET YOU STARTED.
996be9ee 18
494e0205 19 use strict;
20 use warnings;
21 use base 'DBIx::Class::Schema::Loader::DBI';
22 use mro 'c3';
996be9ee 23
494e0205 24 sub _table_uniq_info {
25 my ($self, $table) = @_;
996be9ee 26
494e0205 27 # ... get UNIQUE info for $table somehow
28 # and return a data structure that looks like this:
996be9ee 29
494e0205 30 return [
31 [ 'keyname' => [ 'colname' ] ],
32 [ 'keyname2' => [ 'col1name', 'col2name' ] ],
33 [ 'keyname3' => [ 'colname' ] ],
34 ];
996be9ee 35
494e0205 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 }
996be9ee 40
494e0205 41 sub _table_comment {
42 my ( $self, $table ) = @_;
43 return 'Comment';
44 }
fbcfebdd 45
494e0205 46 sub _column_comment {
47 my ( $self, $table, $column_number ) = @_;
48 return 'Col. comment';
49 }
fbcfebdd 50
494e0205 51 1;
996be9ee 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
c4a69b87 66To import comments from the database you need to implement C<_table_comment>,
67C<_column_comment>
68
b87ab391 69=head1 AUTHORS
be80bba7 70
b87ab391 71See L<DBIx::Class::Schema::Loader/AUTHORS>.
be80bba7 72
73=head1 LICENSE
74
75This library is free software; you can redistribute it and/or modify it under
76the same terms as Perl itself.
77
996be9ee 78=cut
79
801;