1DBIx::Class::Schema::LoUasdeerr:C:oDnBtIr:i:bWuDrtBieItdxi:nP:geC(rl3la)sDso:c:uSmcehnetmaat:i:oLnoader::DBI::Writing(3)
2
3
4
6 DBIx::Class::Schema::Loader::DBI::Writing - Loader subclass writing
7 guide for DBI
8
10 package DBIx::Class::Schema::Loader::DBI::Foo;
11
12 # THIS IS JUST A TEMPLATE TO GET YOU STARTED.
13
14 use strict;
15 use warnings;
16 use base 'DBIx::Class::Schema::Loader::DBI';
17 use mro 'c3';
18
19 sub _table_uniq_info {
20 my ($self, $table) = @_;
21
22 # ... get UNIQUE info for $table somehow
23 # and return a data structure that looks like this:
24
25 return [
26 [ 'keyname' => [ 'colname' ] ],
27 [ 'keyname2' => [ 'col1name', 'col2name' ] ],
28 [ 'keyname3' => [ 'colname' ] ],
29 ];
30
31 # Where the "keyname"'s are just unique identifiers, such as the
32 # name of the unique constraint, or the names of the columns involved
33 # concatenated if you wish.
34 }
35
36 sub _table_comment {
37 my ( $self, $table ) = @_;
38 return 'Comment';
39 }
40
41 sub _column_comment {
42 my ( $self, $table, $column_number ) = @_;
43 return 'Col. comment';
44 }
45
46 1;
47
49 The only required method for new subclasses is "_table_uniq_info", as
50 there is not (yet) any standardized, DBD-agnostic way for obtaining
51 this information from DBI.
52
53 The base DBI Loader contains generic methods that *should* work for
54 everything else in theory, although in practice some DBDs need to
55 override one or more of the other methods. The other methods one might
56 likely want to override are: "_table_pk_info", "_table_fk_info",
57 "_tables_list" and "_extra_column_info". See the included DBD drivers
58 for examples of these.
59
60 To import comments from the database you need to implement
61 "_table_comment", "_column_comment"
62
64 See "AUTHORS" in DBIx::Class::Schema::Loader.
65
67 This library is free software; you can redistribute it and/or modify it
68 under the same terms as Perl itself.
69
70
71
72perl v5.32.0 2D0B2I0x-:0:7C-l2a8ss::Schema::Loader::DBI::Writing(3)