Commit | Line | Data |
996be9ee |
1 | package DBIx::Class::Schema::Loader::DBI::Writing; |
2 | use strict; |
3 | |
4 | # Empty. POD only. |
5 | |
6 | 1; |
7 | |
8 | =head1 NAME |
9 | |
10 | DBIx::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'; |
21 | use Class::C3; |
22 | |
23 | sub _table_uniq_info { |
24 | my ($self, $table) = @_; |
25 | |
26 | # ... get UNIQUE info for $table somehow |
27 | # and return a data structure that looks like this: |
28 | |
29 | return [ |
30 | [ 'keyname' => [ 'colname' ] ], |
31 | [ 'keyname2' => [ 'col1name', 'col2name' ] ], |
32 | [ 'keyname3' => [ 'colname' ] ], |
33 | ]; |
34 | |
35 | # Where the "keyname"'s are just unique identifiers, such as the |
36 | # name of the unique constraint, or the names of the columns involved |
37 | # concatenated if you wish. |
38 | } |
39 | |
40 | 1; |
41 | |
42 | =head1 DETAILS |
43 | |
44 | The only required method for new subclasses is C<_table_uniq_info>, |
45 | as I have not to date found any pseudo-standardized or DBD-agnostic |
46 | way for obtaining this information. |
47 | |
48 | The base DBI Loader contains generic methods that *should* work for |
49 | everything else in theory, although in practice some DBDs need to |
50 | override one or more of the other methods. The other methods one might |
51 | likely want to override are: C<_table_pk_info>, C<_table_fk_info>, and |
52 | C<_tables_list>. See the included DBD drivers for examples of these. |
53 | |
54 | =cut |
55 | |
56 | 1; |