X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=README;h=90b020eccf9e7e22011e51d3f968878d97dd0142;hb=ac5ad55744b535237c6f5f7cfeb60ae972e8a03a;hp=624037a5c21ea5137de24db5845b9ef2b3ec5a8a;hpb=8a6b44efef66c45bdf1336135b0c9c5e5face742;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/README b/README index 624037a..90b020e 100644 --- a/README +++ b/README @@ -6,17 +6,28 @@ SYNOPSIS package My::Schema; use base qw/DBIx::Class::Schema::Loader/; + sub _monikerize { + my $name = shift; + $name = join '', map ucfirst, split /[\W_]+/, lc $name; + $name; + } + __PACKAGE__->load_from_connection( - dsn => "dbi:mysql:dbname", - user => "root", - password => "", + connect_info => [ "dbi:mysql:dbname", + "root", + "mypassword", + { AutoCommit => 1 }, + ], additional_classes => [qw/DBIx::Class::Foo/], additional_base_classes => [qw/My::Stuff/], left_base_classes => [qw/DBIx::Class::Bar/], + components => [qw/ResultSetManager/], + resultset_components => [qw/AlwaysRS/], constraint => '^foo.*', relationships => 1, options => { AutoCommit => 1 }, - inflect => { child => 'children' }, + inflect_map => { child => 'children' }, + moniker_map => \&_monikerize, debug => 1, ); @@ -41,8 +52,8 @@ SYNOPSIS # table-to-classname mappings. my $classes = $schema1->loader->classes; - # Use the schema as per normal for L - my $rs = $schema1->resultset($monikers->{table_table})->search(...); + # Use the schema as per normal for DBIx::Class::Schema + my $rs = $schema1->resultset($monikers->{foo_table})->search(...); DESCRIPTION DBIx::Class::Schema::Loader automates the definition of a @@ -54,8 +65,25 @@ DESCRIPTION DBIx::Class::Schema::Loader::Writing for notes on writing your own db-specific subclass for an unsupported db. - This module requires DBIx::Class::Loader 0.5 or later, and obsoletes - DBIx::Class::Loader for DBIx::Class version 0.5 and later. + This module requires DBIx::Class 0.05 or later, and obsoletes + DBIx::Class::Loader for DBIx::Class version 0.05 and later. + + While on the whole, the bare table definitions are fairly + straightforward, relationship creation is somewhat heuristic, especially + in the choosing of relationship types, join types, and relationship + names. The relationships generated by this module will probably never be + as well-defined as hand-generated ones. Because of this, over time a + complex project will probably wish to migrate off of + DBIx::Class::Schema::Loader. + + It is designed more to get you up and running quickly against an + existing database, or to be effective for simple situations, rather than + to be what you use in the long term for a complex database/project. + + That being said, transitioning your code from a Schema generated by this + module to one that doesn't use this module should be straightforward and + painless, so don't shy away from it just for fears of the transition + down the road. METHODS load_from_connection @@ -63,8 +91,20 @@ METHODS detailed information on the arguments, see the DBIx::Class::Schema::Loader::Generic documentation. + loader + This is an accessor in the generated Schema class for accessing the + DBIx::Class::Schema::Loader::Generic -based loader object that was used + during construction. See the DBIx::Class::Schema::Loader::Generic docs + for more information on the available loader methods there. + +KNOWN BUGS + Aside from relationship definitions being less than ideal in general, + this version is known not to handle the case of multiple relationships + between the same pair of tables. All of the relationship code will be + overhauled on the way to 0.03, at which time that bug will be addressed. + AUTHOR - Brandon Black, "bblack@gmail.com" + Brandon Black, "blblack@gmail.com" Based on DBIx::Class::Loader by Sebastian Riedel