From: Rafael Kitover Date: Wed, 27 Jul 2011 03:51:16 +0000 (-0400) Subject: warn if no tables found in helper X-Git-Tag: v0.51~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Model-DBIC-Schema.git;a=commitdiff_plain;h=8af34f38f8b3b7ff5035ccf57e7d485f43378e1c warn if no tables found in helper After dumping the schema in the helper, loads the dumped Schema, checks ->sources and if empty prints a warning with a suggestion to specify db_schema. --- diff --git a/lib/Catalyst/Helper/Model/DBIC/Schema.pm b/lib/Catalyst/Helper/Model/DBIC/Schema.pm index 16e8634..b947be4 100644 --- a/lib/Catalyst/Helper/Model/DBIC/Schema.pm +++ b/lib/Catalyst/Helper/Model/DBIC/Schema.pm @@ -596,6 +596,19 @@ sub _gen_static_schema { $self->loader_args, [$self->connect_info] ); + + require lib; + lib->import($schema_dir); + + Class::MOP::load_class($self->schema_class); + + my @sources = $self->schema_class->sources; + + if (not @sources) { + warn <<'EOF'; +WARNING: No tables found, did you forget to specify db_schema? +EOF + } } sub _gen_model {