X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader.pm;h=a495e40ffc5e94304d68f6726e8cd1bb10699193;hb=c39e35077d88eb3c81696032a2e51fdf5cb69eab;hp=bbc8fd31071d4bc1d1213de86507a479af7a5ed6;hpb=59cfa251ef35274d0632837629a2c15919d19dff;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index bbc8fd3..a495e40 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -2,8 +2,7 @@ package DBIx::Class::Schema::Loader; use strict; use warnings; -use base qw/DBIx::Class::Schema/; -use base qw/Class::Data::Accessor/; +use base qw/DBIx::Class::Schema Class::Data::Accessor/; use Carp::Clan qw/^DBIx::Class/; use UNIVERSAL::require; use Class::C3; @@ -12,11 +11,10 @@ use Scalar::Util qw/ weaken /; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -our $VERSION = '0.03999_01'; +our $VERSION = '0.04002'; -__PACKAGE__->mk_classaccessor('dump_to_dir'); __PACKAGE__->mk_classaccessor('_loader_args' => {}); -__PACKAGE__->mk_classaccessor('_loader_invoked'); +__PACKAGE__->mk_classaccessors(qw/dump_to_dir _loader_invoked _loader/); =head1 NAME @@ -47,16 +45,17 @@ L by scanning database table definitions and setting up the columns, primary keys, and relationships. DBIx::Class::Schema::Loader currently supports only the DBI storage type. -It has explicit support for L, L, L, and -L. Other DBI drivers may function to a greater or lesser -degree with this loader, depending on how much of the DBI spec they -implement, and how standard their implementation is. Patches to make -other DBDs work correctly welcome. +It has explicit support for L, L, L, +L, and L. Other DBI drivers may function to +a greater or lesser degree with this loader, depending on how much of the +DBI spec they implement, and how standard their implementation is. + +Patches to make other DBDs work correctly welcome. See L for notes on writing your own vendor-specific subclass for an unsupported DBD driver. -This module requires L 0.06 or later, and obsoletes +This module requires L 0.07006 or later, and obsoletes the older L. This module is designed more to get you up and running quickly against @@ -77,9 +76,10 @@ detailed information on all of the arguments, most of which are only useful in fairly complex scenarios, see the L documentation. -One must call C before any connection is made, -or embed the C in the connection information itself -as shown below. Setting C after the connection has +If you intend to use C, you must call +C before any connection is made, or embed the +C in the connection information itself as shown +below. Setting C after the connection has already been made is useless. =cut @@ -111,7 +111,8 @@ sub _invoke_loader { croak qq/Could not load storage_type loader "$impl": / . qq/"$UNIVERSAL::require::ERROR"/; - $impl->new(%$args)->load; + $self->_loader($impl->new(%$args)); + $self->_loader->load; $self->_loader_invoked(1); $self; @@ -284,6 +285,18 @@ sub make_schema_at { $target->connection(@$connect_info); } +=head2 rescan + +Re-scans the database for newly added tables since the initial +load, and adds them to the schema at runtime, including relationships, +etc. Does not process drops or changes. + +Returns a list of the new monikers added. + +=cut + +sub rescan { my $self = shift; $self->_loader->rescan($self) } + =head1 EXAMPLE Using the example in L as a basis