docs and reqs update for 0.01000 release
[dbsrgits/DBIx-Class-Schema-Loader.git] / README
1 NAME
2     DBIx::Class::Schema::Loader - Dynamic definition of a
3     DBIx::Class::Schema
4
5 SYNOPSIS
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
47 DESCRIPTION
48     THIS IS A DEVELOPMENT RELEASE. This is 0.01000, the first public
49     release. Expect things to be broken in various ways. Expect the entire
50     design to be fatally flawed. Expect the interfaces to change if it
51     becomes neccessary. It's mostly here for people to poke at it and find
52     the flaws in it. 0.02 will hopefully have some sanity when we get there.
53
54     DBIx::Class::Schema::Loader automates the definition of a
55     DBIx::Class::Schema by scanning table schemas and setting up columns and
56     primary keys.
57
58     DBIx::Class::Schema::Loader supports MySQL, Postgres, SQLite and DB2.
59     See DBIx::Class::Schema::Loader::Generic for more, and
60     DBIx::Class::Schema::Loader::Writing for notes on writing your own
61     db-specific subclass for an unsupported db.
62
63     This module requires DBIx::Class::Loader 0.5 or later, and obsoletes
64     DBIx::Class::Loader for DBIx::Class version 0.5 and later.
65
66 METHODS
67   load_from_connection
68     Example in Synopsis above demonstrates the available arguments. For
69     detailed information on the arguments, see the
70     DBIx::Class::Schema::Loader::Generic documentation.
71
72 AUTHOR
73     Brandon Black, "bblack@gmail.com"
74
75     Based on DBIx::Class::Loader by Sebastian Riedel
76
77     Based upon the work of IKEBE Tomohiro
78
79 THANK YOU
80     Adam Anderson, Andy Grundman, Autrijus Tang, Dan Kubb, David Naughton,
81     Randal Schwartz, Simon Flack and all the others who've helped.
82
83 LICENSE
84     This library is free software; you can redistribute it and/or modify it
85     under the same terms as Perl itself.
86
87 SEE ALSO
88     DBIx::Class
89