dieing uninformatively.
plain ::Storage::DBI
* Fixes
- - Fix exiting via next warnings from ResultSource
- Fix ::Storage::DBI::* MRO problems on 5.8.x perls
- Disable mysql_auto_reconnect for MySQL - depending on the ENV
it sometimes defaults to on and causes major borkage on older
when deploying a schema via sql file
- Fix reverse_relationship_info on prototypical result sources
(sources not yet registered with a schema)
+ - Warn and skip relationships missing from a partial schema during
+ dbic cascade_delete
- Automatically require the requested cursor class before use
(RT#64795)
- Work around a Firebird ODBC driver bug exposed by DBD::ODBC 1.29
+ - Fix exiting via next warnings in ResultSource::sequence()
* Misc
- Only load Class::C3 and friends if necessary ($] < 5.010)
use strict;
use warnings;
+use Carp::Clan qw/^DBIx::Class|^Try::Tiny/;
our %_pod_inherit_config =
(
my $ret = $self->next::method(@rest);
foreach my $rel (@cascade) {
- $self->search_related($rel)->delete_all;
+ if( my $rel_rs = eval{ $self->search_related($rel) } ) {
+ $rel_rs->delete_all;
+ } else {
+ carp "Skipping cascade delete on relationship '$rel' - related resultsource '$rels{$rel}{class}' is not registered with this schema";
+ next;
+ }
}
$guard->commit;
{
my $handle = $schema->source('Artist')->handle;
- my $rowdata = {
- artistid => 3,
- charfield => undef,
- name => "We Are In Rehab",
- rank => 13
- };
+ my $rowdata = { $schema->resultset('Artist')->next->get_columns };
my $rs = DBIx::Class::ResultSet->new($handle);
my $rs_result = $rs->next;
--- /dev/null
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Warn;
+use Test::Exception;
+
+use lib 't/lib';
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+$schema->_unregister_source('CD');
+
+warnings_like {
+ lives_ok {
+ $_->delete for $schema->resultset('Artist')->all;
+ } 'delete on rows with dangling rels lives';
+} [
+ # 12 == 3 artists * failed cascades:
+ # cds
+ # cds_unordered
+ # cds_very_very_very_long_relationship_name
+ (qr/skipping cascad/i) x 9
+], 'got warnings about cascading deletes';
+
+done_testing;
+
__PACKAGE__->has_many(
'mapped_artists', 'DBICTest::Schema::Artist',
[ {'foreign.artistid' => 'self.id1'}, {'foreign.artistid' => 'self.id2'} ],
+ { cascade_delete => 0 },
);
1;