use_moose
only_autoclean
overwrite_modifications
+ generated_classes
relationship_attrs
$self->{class_to_table} = {};
$self->{classes} = {};
$self->{_upgrading_classes} = {};
+ $self->{generated_classes} = [];
$self->{schema_class} ||= ( ref $self->{schema} || $self->{schema} );
$self->{schema} ||= $self->{schema_class};
# The relationship loader needs a working schema
local $self->{quiet} = 1;
local $self->{dump_directory} = $self->{temp_directory};
+ local $self->{generated_classes} = [];
$self->_reload_classes(\@tables);
$self->_load_relationships(\@tables);
}
}
+ push @{$self->generated_classes}, $class;
+
$text .= $self->_sig_comment(
$self->version_to_dump,
POSIX::strftime('%Y-%m-%d %H:%M:%S', localtime)
contain multiple entries per table for the original and normalized table
names, as above in L</monikers>.
+=head2 generated_classes
+
+Returns an arrayref of classes that were actually generated (i.e. not
+skipped because there were no changes).
+
=head1 NON-ENGLISH DATABASES
If you use the loader on a database with table and column names in a language
[ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
} 'no death with dump_directory set' or diag "Dump failed: $@";
+is_deeply(
+ [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
+ [ sort 'DBICTest::Schema::1', map "DBICTest::Schema::1::Result::$_", qw(Foo Bar) ],
+ 'generated_classes has schema and result classes'
+);
+
DBICTest::Schema::1->_loader_invoked(undef);
SKIP: {
warnings_exist { DBICTest::Schema::1->connect($make_dbictest_db::dsn) }
[ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
+ is_deeply(
+ [ sort @{ DBICTest::Schema::1->loader->generated_classes } ],
+ [ ],
+ 'no classes generated on second dump'
+ );
+
rmtree($dump_path, 1, 1);
}
[ qr|^Dumping manual schema|, qr|^Schema dump completed| ];
} 'no death with dump_directory set (overwrite1)' or diag "Dump failed: $@";
+is_deeply(
+ [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
+ [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
+ 'generated_classes has schema and result classes'
+);
+
DBICTest::Schema::2->_loader_invoked(undef);
lives_ok {
];
} 'no death with dump_directory set (overwrite2)' or diag "Dump failed: $@";
+is_deeply(
+ [ sort @{ DBICTest::Schema::2->loader->generated_classes } ],
+ [ sort 'DBICTest::Schema::2', map "DBICTest::Schema::2::Result::$_", qw(Foo Bar) ],
+ 'all classes regenerated with really_erase_my_files',
+);
+
done_testing();
END { rmtree($dump_path, 1, 1); }