switched to Build.PL, updated deps, updated docs
[dbsrgits/DBIx-Class-Schema-Loader.git] / README
CommitLineData
8a6b44ef 1NAME
2 DBIx::Class::Schema::Loader - Dynamic definition of a
3 DBIx::Class::Schema
4
5SYNOPSIS
6 package My::Schema;
7 use base qw/DBIx::Class::Schema::Loader/;
8
9 __PACKAGE__->load_from_connection(
10 dsn => "dbi:mysql:dbname",
11 user => "root",
12 password => "",
13 additional_classes => [qw/DBIx::Class::Foo/],
14 additional_base_classes => [qw/My::Stuff/],
15 left_base_classes => [qw/DBIx::Class::Bar/],
16 constraint => '^foo.*',
17 relationships => 1,
18 options => { AutoCommit => 1 },
19 inflect => { child => 'children' },
20 debug => 1,
21 );
22
23 # in seperate application code ...
24
25 use My::Schema;
26
27 my $schema1 = My::Schema->connect( $dsn, $user, $password, $attrs);
28 # -or-
29 my $schema1 = "My::Schema";
30 # ^^ defaults to dsn/user/pass from load_from_connection()
31
32 # Get a list of the original (database) names of the tables that
33 # were loaded
34 my @tables = $schema1->loader->tables;
35
36 # Get a hashref of table_name => 'TableName' table-to-moniker
37 # mappings.
38 my $monikers = $schema1->loader->monikers;
39
40 # Get a hashref of table_name => 'My::Schema::TableName'
41 # table-to-classname mappings.
42 my $classes = $schema1->loader->classes;
43
44 # Use the schema as per normal for L<DBIx::Class::Schema>
45 my $rs = $schema1->resultset($monikers->{table_table})->search(...);
46
47DESCRIPTION
48 DBIx::Class::Schema::Loader automates the definition of a
49 DBIx::Class::Schema by scanning table schemas and setting up columns and
50 primary keys.
51
52 DBIx::Class::Schema::Loader supports MySQL, Postgres, SQLite and DB2.
53 See DBIx::Class::Schema::Loader::Generic for more, and
54 DBIx::Class::Schema::Loader::Writing for notes on writing your own
55 db-specific subclass for an unsupported db.
56
57 This module requires DBIx::Class::Loader 0.5 or later, and obsoletes
58 DBIx::Class::Loader for DBIx::Class version 0.5 and later.
59
60METHODS
61 load_from_connection
62 Example in Synopsis above demonstrates the available arguments. For
63 detailed information on the arguments, see the
64 DBIx::Class::Schema::Loader::Generic documentation.
65
66AUTHOR
67 Brandon Black, "bblack@gmail.com"
68
69 Based on DBIx::Class::Loader by Sebastian Riedel
70
71 Based upon the work of IKEBE Tomohiro
72
73THANK YOU
74 Adam Anderson, Andy Grundman, Autrijus Tang, Dan Kubb, David Naughton,
75 Randal Schwartz, Simon Flack and all the others who've helped.
76
77LICENSE
78 This library is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
80
81SEE ALSO
82 DBIx::Class
83