view release on metacpan or search on metacpan
lib/DBIO/Oracle/Diff/Index.pm view on Meta::CPAN
=head2 diff
my @ops = DBIO::Oracle::Diff::Index->diff($source, $target);
Walks tables present in B<both> C<$source> and C<$target> (C<scope = both>).
Source-only tables have their indexes cascaded by the table drop, so they
are not walked here; brand-new tables inline their indexes in the CREATE
TABLE statement emitted by L<DBIO::Oracle::Diff::Table>, so target-only
tables are skipped too.
=head2 as_sql
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIO/PostgreSQL/Age/Storage.pm view on Meta::CPAN
});
}
sub drop_graph {
my ($self, $name, $cascade) = @_;
$self->dbh_do(sub {
my (undef, $dbh) = @_;
$dbh->do(
'SELECT * FROM ag_catalog.drop_graph(?, ?)',
undef, $name, $cascade ? 1 : 0,
);
});
}
lib/DBIO/PostgreSQL/Age/Storage.pm view on Meta::CPAN
$$ MATCH (a:Person {name: $name})-[:KNOWS]->(b) RETURN b.name $$,
['friend'],
{ name => 'Alice' },
);
$storage->drop_graph('social', 1); # cascade
=head1 DESCRIPTION
A storage B<layer> that adds Apache AGE graph database support -- connection
initialization, graph lifecycle management, and Cypher query execution -- to a
lib/DBIO/PostgreSQL/Age/Storage.pm view on Meta::CPAN
Creates a new Apache AGE graph with the given name.
=head2 drop_graph
$storage->drop_graph('social');
$storage->drop_graph('social', 1); # cascade
Drops the named graph. Pass a true second argument to cascade the drop to all
vertices and edges within the graph.
=head2 cypher_async
=head2 create_graph_async
view all matches for this distribution
view release on metacpan or search on metacpan
skips cleanly): a storage LAYER composes over DBIO::PostgreSQL::Storage
and its ::Async mirror over DBIO::PostgreSQL::Storage::Async under
{ async => 'future_io' } â the walk resolves the driver transport off
the composition base, not the layer mixin (karr #28)
- xbin/dbio-pg-k8s: use the official postgres:18 image (src.ci retired)
- Add t/40-diff-drop-table-index-cascade.t and extend t/05-diff-index.t:
full-diff regression for the DROP INDEX / DROP TABLE CASCADE collision
(karr #32) plus Diff::Index unit cases for the new tables-aware drop
suppression, including an over-suppression guard (a surviving table's
index is still dropped standalone)
view all matches for this distribution
view release on metacpan or search on metacpan
t/34-diff-column-changed.t
t/35-adapter.t
t/35exception_inaction.t
t/36-roundtrip-base-types.t
t/37-rebuild.t
t/40-diff-drop-table-index-cascade.t
t/46where_attribute.t
t/52leaks.t
t/53lean_startup.t
t/60core.t
t/61findnot.t
t/76joins.t
t/76select.t
t/78self_referencial.t
t/79aliasing.t
t/80unique.t
t/82cascade_copy.t
t/83cache.t
t/86sqlt.t
t/87ordered.t
t/88result_set_column.t
t/90join_torture.t
t/count/joined.t
t/count/prefetch.t
t/count/search_related.t
t/debug/core.t
t/debug/pretty.t
t/delete/cascade_missing.t
t/delete/complex.t
t/delete/m2m.t
t/delete/related.t
t/discard_changes_in_DESTROY.t
t/helpers/resultset_shortcuts.t
t/multi_create/m2m.t
t/multi_create/multilev_single_PKeqFK.t
t/multi_create/reentrance_count.t
t/multi_create/standard.t
t/multi_create/torture.t
t/ordered/cascade_delete.t
t/ordered/unordered_movement.t
t/pager/dbic_core.t
t/populate_more.t
t/prefetch/attrs_untouched.t
t/prefetch/correlated.t
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"artwork_to_artists",
"CDTest::Schema::Result::ArtworkToArtist",
{ "foreign.artist_id" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 cds
Type: has_many
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"cds",
"CDTest::Schema::Result::CD",
{ "foreign.artist" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 artwork_cds
Type: many_to_many
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/AuditAny/Collector/AutoDBIC.pm view on Meta::CPAN
set_primary_key => ['id'],
has_many => [
$self->change_data_rel,
$namespace . '::' . $self->change_source_name,
{ "foreign.changeset_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
]
]
},
$self->change_source_name => {
table_name => $self->change_table_name,
lib/DBIx/Class/AuditAny/Collector/AutoDBIC.pm view on Meta::CPAN
],
has_many => [
$self->column_data_rel,
$namespace . '::' . $self->column_change_source_name,
{ "foreign.change_id" => "self.id" },
{ cascade_copy => 0, cascade_delete => 0 },
]
]
},
$self->column_change_source_name => {
table_name => $self->column_change_table_name,
view all matches for this distribution
view release on metacpan or search on metacpan
t/011_update_on_deleted_row.t view on Meta::CPAN
]);
my $title = $schema->resultset('Title')->first;
$schema->txn_do(sub {
$title->book->delete;
$title->update({name => 'test2'}); # update cascades to deleted book
});
is $al_schema->resultset('AuditLogChangeset')->count, 1, 'One changeset logged';
my $cset = $al_schema->resultset('AuditLogChangeset')->first ;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Bootstrap/Simple.pm view on Meta::CPAN
},
references => {
company => {
class => 'YourApp::DB::Company',
column => 'company_id',
cascade_update => 1, #defaults to 0
cascade_delete => 1, #defaults to 0
cascade_copy => 1, #defaults to 0
},
password => {
class => 'YourApp::DB::Password',
column => 'password_id',
lib/DBIx/Class/Bootstrap/Simple.pm view on Meta::CPAN
},
references => {
company => {
class => 'YourApp::DB::Company',
column => 'company_id',
cascade_update => 1, # defaults to 0
cascade_delete => 1, # defaults to 0
cascade_copy => 1, # defaults to 0
},
password => {
class => 'YourApp::DB::Password',
column => 'password_id',
lib/DBIx/Class/Bootstrap/Simple.pm view on Meta::CPAN
{
$module->has_many(
$rkey, $reference->{class},
{ "foreign.$remote_col", "self.$local_col" },
{
cascade_delete => $reference->{cascade_delete} || 0,
cascade_copy => $reference->{cascade_copy} || 0,
cascade_update => $reference->{cascade_update} || 0,
accessor => 'multi',
},
);
$reference->{class}->belongs_to( $remote_col => $module );
}
lib/DBIx/Class/Bootstrap/Simple.pm view on Meta::CPAN
$module->$meth(
$local_col, $reference->{class},
{ "foreign.$remote_col", "self.$local_col" },
{
cascade_delete => $reference->{cascade_delete} || 0,
cascade_copy => $reference->{cascade_copy} || 0,
cascade_update => $reference->{cascade_update} || 0,
accessor => 'filter',
},
);
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/DeleteAction.pm view on Meta::CPAN
=item * null
Set all columns in related rows pointing to this record to NULL. Only works
on 'has_many' relationships.
=item * delete OR cascade
Delete all related records one by one. This can trigger further delete
actions.
=item * deleteall
lib/DBIx/Class/DeleteAction.pm view on Meta::CPAN
# Ignore relation with no 'delete_action' key set
next RELATIONSHIP
unless $relationship_info->{attrs}{delete_action};
# Unset DBIC key cascade_delete attribute, so that we do not
# work twice
$relationship_info->{attrs}{cascade_delete} = 0;
# Get delete action parameter value
my $delete_action = $relationship_info->{attrs}{delete_action};
next RELATIONSHIP
lib/DBIx/Class/DeleteAction.pm view on Meta::CPAN
$related->update($update);
} else {
warn("Delete action 'null' does not work with ".$relationship_info->{attrs}{accessor}." relations");
}
# Action: DELETE
} elsif ($delete_action eq 'delete' || $delete_action eq 'cascade') {
warn('DeleteAction: DELETE '.$self.'->'.$relationship) if $debug;
if ($related->isa('DBIx::Class::ResultSet')) {
while (my $item = $related->next) {
$item->delete($params);
}
lib/DBIx/Class/DeleteAction.pm view on Meta::CPAN
=head1 CAVEATS
Note that the C<delete> method in L<DBIx::Class::ResultSet> will not run
DeleteAction triggers. See C<delete_all> if you need triggers to run.
Any database-level cascade, restrict or trigger will be performed AFTER
DBIx-Class-DeleteAction based triggers.
Always use transactions, or else you might end up with inconsistent data.
=head1 SUPPORT
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/DeploymentHandler.pm view on Meta::CPAN
To enable the various logging levels all you need to do is set an environment
variables: C<DBICDH_FATAL>, C<DBICDH_ERROR>, C<DBICDH_WARN>, C<DBICDH_INFO>,
C<DBICDH_DEBUG>, and C<DBICDH_TRACE>. Each level can be set on its own,
but the default is the first three on and the last three off, and the levels
cascade, so if you turn on trace the rest will turn on automatically.
=head1 DONATIONS
If you'd like to thank me for the work I've done on this module, don't give me
a donation. I spend a lot of free time creating free software, but I do it
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Sample/Schema/Result/Album.pm view on Meta::CPAN
__PACKAGE__->has_many(
"people",
"Sample::Schema::Result::Person",
{ "foreign.favorite_album_id" => "self.album_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 producer
Type: belongs_to
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Events.pm view on Meta::CPAN
Default is C<events>, but you can override it:
__PACKAGE__->has_many(
'cd_events' =>
( 'MyApp::Schema::Result::ArtistEvents', 'cdid' ),
{ cascade_delete => 0 },
);
__PACKAGE__->events_relationship('cd_events');
=head2 Tables
lib/DBIx/Class/Events.pm view on Meta::CPAN
__PACKAGE__->load_components( qw/ Events / );
# A different name can be used with the "events_relationship" attribute
__PACKAGE__->has_many(
'events' => ( 'MyApp::Schema::Result::ArtistEvent', 'artistid' ),
{ cascade_delete => 0 },
);
You can also add custom events to track when something happens. For example,
you can create a method to add events when an artist changes their name:
lib/DBIx/Class/Events.pm view on Meta::CPAN
last_name_change_id => { data_type => 'integer' } );
__PACKAGE__->has_one(
'last_name_change' => 'MyApp::Schema::Result::ArtistEvent',
{ 'foreign.artisteventid' => 'self.last_name_change_id' },
{ cascade_delete => 0 },
);
sub change_name {
my ( $self, $new_name ) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Fixtures.pm view on Meta::CPAN
$self->msg("- clearing DB of existing tables");
$pre_schema->storage->txn_do(sub {
$pre_schema->storage->with_deferred_fk_checks(sub {
foreach my $table (@tables) {
eval {
$dbh->do("drop table $table" . ($params->{cascade} ? ' cascade' : '') )
};
}
});
});
lib/DBIx/Class/Fixtures.pm view on Meta::CPAN
# DDL to deploy after populating records, ie. FK constraints
post_ddl => '/home/me/app/sql/post_ddl.sql',
# use CASCADE option when dropping tables
cascade => 1,
# optional, set to 1 to run ddl but not populate
no_populate => 0,
# optional, set to 1 to run each fixture through ->create rather than have
lib/DBIx/Class/Fixtures.pm view on Meta::CPAN
If needed, you can specify a post_ddl attribute which is a DDL to be applied
after all the fixtures have been added to the database. A good use of this
option would be to add foreign key constraints since databases like Postgresql
cannot disable foreign key checks.
If your tables have foreign key constraints you may want to use the cascade
attribute which will make the drop table functionality cascade, ie 'DROP TABLE
$table CASCADE'.
C<directory> is a required attribute.
If you wish for DBIx::Class::Fixtures to clear the database for you pass in
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"artwork_to_artists",
"CDTest::Schema::Result::ArtworkToArtist",
{ "foreign.artist_id" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 cds
Type: has_many
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"cds",
"CDTest::Schema::Result::CD",
{ "foreign.artist" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 artwork_cds
Type: many_to_many
view all matches for this distribution
view release on metacpan or search on metacpan
examples/MusicBase/share/migrations/_source/deploy/1/001-auto-__VERSION.yml view on Meta::CPAN
- artist_id
_relationships:
cd_rs:
attrs:
accessor: multi
cascade_copy: 1
cascade_delete: 1
join_type: LEFT
class: MusicBase::Schema::Result::Cd
cond:
foreign.artist_fk: self.artist_id
source: MusicBase::Schema::Result::Cd
examples/MusicBase/share/migrations/_source/deploy/1/001-auto-__VERSION.yml view on Meta::CPAN
foreign.artist_id: self.artist_fk
source: MusicBase::Schema::Result::Artist
track_rs:
attrs:
accessor: multi
cascade_copy: 1
cascade_delete: 1
join_type: LEFT
class: MusicBase::Schema::Result::Track
cond:
foreign.cd_fk: self.cd_id
source: MusicBase::Schema::Result::Track
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Sample/Schema/Result/Customer.pm view on Meta::CPAN
__PACKAGE__->has_many(
"orders",
"Sample::Schema::Result::Order",
{ "foreign.customer_id" => "self.customer_id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 person
Type: belongs_to
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/PgLogTest/Schema/Result/Role.pm view on Meta::CPAN
__PACKAGE__->has_many(
"user_roles",
"PgLogTest::Schema::Result::UserRole",
{ "foreign.RoleId" => "self.Id" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 users
Type: many_to_many
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/ResultSource/Table/Previewed.pm view on Meta::CPAN
);
$new_source->result_class( $target_class );
$target_class->result_source_instance($new_source)
if $target_class->can('result_source_instance');
$new_source->relationship_info($_)->{attrs}{cascade_delete} = 0
for $new_source->relationships;
my $new_source_name =
$self->source_name . '::preview';
$schema->register_extra_source( $new_source_name => $new_source );
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/01-rdbohelpers.t view on Meta::CPAN
ok( exists $m2m_tracks->{m2m}, "cd_tracks is a m2m" );
is_deeply(
$m2m_tracks,
{ attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
is_depends_on => 0,
join_type => "LEFT",
},
class => "MyDBIC::Schema::CdTrackJoin",
cond => { "foreign.cdid" => "self.cdid" },
t/01-rdbohelpers.t view on Meta::CPAN
ok( exists $m2m_cds->{m2m}, "track_cds is a m2m" );
is_deeply(
$m2m_cds,
{ attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
is_depends_on => 0,
join_type => "LEFT",
},
class => "MyDBIC::Schema::CdTrackJoin",
cond => { "foreign.trackid" => "self.trackid" },
t/01-rdbohelpers.t view on Meta::CPAN
# m2m to itself must be tested in a resultsource object not class
is_deeply(
$cd1->relationship_info('relationships'),
{ attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
is_depends_on => 0,
join_type => "LEFT",
},
class => "MyDBIC::Schema::CdToItself",
cond => { "foreign.cdid_one" => "self.cdid" },
view all matches for this distribution
view release on metacpan or search on metacpan
t/03_prefetch_problem.t view on Meta::CPAN
__PACKAGE__->load_components(qw/RandomStringColumns Core/);
__PACKAGE__->table('bar');
__PACKAGE__->add_columns(qw(foo_id session_id u_rand_id));
__PACKAGE__->set_primary_key('session_id');
__PACKAGE__->belongs_to('foo_id', 'TestDB::Schema::Foo', 'foo_id', {cascade_delete => 0});
__PACKAGE__->resultset_attributes({where => {'foo_id.delete_fg' => 0}, prefetch => 'foo_id', order_by => 'me.session_id DESC'});
__PACKAGE__->random_string_columns('u_rand_id');
__PACKAGE__->random_string_columns('session_id');
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
blob tinyblob mediumblob longblob text tinytext mediumtext longtext ntext bytea
date datetime timestamp enum bool boolean
uuid json jsonb inflate_json array
primary_key idx create_index unique sqlt_add_index sqlt_add_constraint
rel_one rel_many has_one might_have has_many belongs_to many_to_many
ddl_cascade dbic_cascade
);
our %EXPORT_TAGS;
$EXPORT_TAGS{V2}= \@V2;
export @V2;
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
is_foreign_key_constraint => 1,
undef_on_null_fk => 1,
) : (
is_depends_on => 0,
)),
cascade_copy => 0, cascade_delete => 0,
%$opts
}
);
} else {
require DBIx::Class::Core;
DBIx::Class::Core->can($reltype)->($pkg, $relname, $rel_pkg, $dbic_colmap, $opts);
}
}
sub ddl_cascade {
my $mode= shift;
$mode= 'CASCADE' if !defined $mode || $mode eq '1';
$mode= 'RESTRICT' if $mode eq '0';
return
on_update => $mode,
on_delete => $mode;
}
sub dbic_cascade {
my $mode= defined $_[0]? $_[0] : 1;
return
cascade_copy => $mode,
cascade_delete => $mode;
}
sub view {
my ($name, $definition, %opts) = @_;
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
blob tinyblob mediumblob longblob text tinytext mediumtext longtext ntext bytea
date datetime timestamp enum bool boolean
uuid json jsonb inflate_json array
primary_key idx create_index unique sqlt_add_index sqlt_add_constraint
rel_one rel_many has_one might_have has_many belongs_to many_to_many
ddl_cascade dbic_cascade
=head2 C<:V1>
See L<DBIx::Class::ResultDDL::V1>. The primary difference from V2 is a bug in
C<datetime($timezone)> where the timezone generated the wrong DBIC arguments.
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
__PACKAGE__->add_relationship(
$rel_name, $peer_class, { "foreign.$fcol" => "self.$mycol" },
{
join_type => 'LEFT',
accessor => 'single',
cascade_copy => 0,
cascade_delete => 0,
is_depends_on => $is_f_pk, # auto-detected, unless specified
($is_f_pk? fk_columns => { $mycol => 1 } : ()),
@attr_list
}
);
lib/DBIx/Class/ResultDDL.pm view on Meta::CPAN
rel_many $name => { $my_col => "$class.$col", ... }, @attr_list;
rel_many $name => 'JOIN $peer_class ON $sql', @attr_list;
Same as L</rel_one>, but generates a one-to-many relation with a multi-accessor.
=head2 ddl_cascade
ddl_cascade; # same as ddl_cascade("CASCADE");
ddl_cascade(1); # same as ddl_cascade("CASCADE");
ddl_cascade(0); # same as ddl_cascade("RESTRICT");
ddl_cascade($mode);
Helper method to generate C<@options> for above. It generates
on_update => $mode, on_delete => $mode
This does not affect client-side cascade, and is only used by Schema::Loader to generate DDL
for the foreign keys when the table is deployed.
=head2 dbic_cascade
dbic_cascade; # same as dbic_cascade(1)
dbic_cascade($enabled);
Helper method to generate C<@options> for above. It generates
cascade_copy => $enabled, cascade_delete => $enabled
This re-enables the dbic-side cascading that was disabled by default in the C<rel_> functions.
=head2 view
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/AnotherTestDB/OnePK/Schema/Result/Item.pm view on Meta::CPAN
__PACKAGE__->has_many(
"relateditems",
"AnotherTestDB::OnePK::Schema::Result::RelatedItem",
{ "foreign.item_id" => "self.idcol" },
{ cascade_copy => 0, cascade_delete => 0 },
);
__PACKAGE__->has_many(
"true_relateditems",
"AnotherTestDB::OnePK::Schema::Result::RelatedItem",
{ "foreign.item_id" => "self.idcol" },
{where => { 'conditionitems.condition' => 'true'},
'join' => qq/conditionitems/,
cascade_copy => 0, cascade_delete => 0 },
);
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Schema/Diff.pm view on Meta::CPAN
$hash = $D->filter_out({ events => [qw(added deleted)] })
->filter_out('Album','Genre')
->filter('constraints')
->diff;
# All changes to relationship attrs except for 'cascade_delete' in
# relationships named 'artists':
$hash = $D->filter_out('relationships/artists.attrs.cascade_delete')
->filter('relationships/*.attrs')
->diff;
=head1 DESCRIPTION
lib/DBIx/Class/Schema/Diff.pm view on Meta::CPAN
},
staffs => {
_event => "changed",
diff => {
attrs => {
cascade_delete => 1
}
}
}
}
},
lib/DBIx/Class/Schema/Diff.pm view on Meta::CPAN
'Artist:columns/my_enum.extra.list'
The structure is specific to the type. The dot-separated path applies to the data returned by L<column_info|DBIx::Class::ResultSource#column_info> for columns and
L<relationship_info|DBIx::Class::ResultSource#relationship_info> for relationships. For instance,
the following matches changes to C<cascade_delete> of a specific relationship named 'some_rel'
in the 'Artist' source:
'Artist:relationships/some_rel.attrs.cascade_delete'
Filter arguments can also match I<broadly> using the wildcard asterisk character (C<*>). For
instance, to match I<'isa'> changes in any source:
'*:isa'
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/dbixcsl_common_tests.pm view on Meta::CPAN
ok ($rsobj4->result_source->has_relationship('loader_test5s_from'),
"rel with preposition 'from' pluralized correctly");
# check default relationship attributes
is try { $rsobj3->result_source->relationship_info('loader_test4zes')->{attrs}{cascade_delete} }, 0,
'cascade_delete => 0 on has_many by default';
is try { $rsobj3->result_source->relationship_info('loader_test4zes')->{attrs}{cascade_copy} }, 0,
'cascade_copy => 0 on has_many by default';
ok ((not try { exists $rsobj3->result_source->relationship_info('loader_test4zes')->{attrs}{on_delete} }),
'has_many does not have on_delete');
ok ((not try { exists $rsobj3->result_source->relationship_info('loader_test4zes')->{attrs}{on_update} }),
t/lib/dbixcsl_common_tests.pm view on Meta::CPAN
is try { $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{is_deferrable} },
$default_is_deferrable,
"is_deferrable => $default_is_deferrable on belongs_to by default";
ok ((not try { exists $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{cascade_delete} }),
'belongs_to does not have cascade_delete');
ok ((not try { exists $rsobj4->result_source->relationship_info('fkid_singular')->{attrs}{cascade_copy} }),
'belongs_to does not have cascade_copy');
is try { $rsobj27->result_source->relationship_info('loader_test28')->{attrs}{cascade_delete} }, 0,
'cascade_delete => 0 on might_have by default';
is try { $rsobj27->result_source->relationship_info('loader_test28')->{attrs}{cascade_copy} }, 0,
'cascade_copy => 0 on might_have by default';
ok ((not try { exists $rsobj27->result_source->relationship_info('loader_test28')->{attrs}{on_delete} }),
'might_have does not have on_delete');
ok ((not try { exists $rsobj27->result_source->relationship_info('loader_test28')->{attrs}{on_update} }),
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/Schema/Loader/Base.pm view on Meta::CPAN
override the introspected attributes of the foreign key if any.
For example:
relationship_attrs => {
has_many => { cascade_delete => 1, cascade_copy => 1 },
might_have => { cascade_delete => 1, cascade_copy => 1 },
},
use this to turn L<DBIx::Class> cascades to on on your
L<has_many|DBIx::Class::Relationship/has_many> and
L<might_have|DBIx::Class::Relationship/might_have> relationships, they default
to off.
Can also be a coderef, for more precise control, in which case the coderef gets
lib/DBIx/Class/Schema/Loader/Base.pm view on Meta::CPAN
},
These are the default attributes:
has_many => {
cascade_delete => 0,
cascade_copy => 0,
},
might_have => {
cascade_delete => 0,
cascade_copy => 0,
},
belongs_to => {
on_delete => 'CASCADE',
on_update => 'CASCADE',
is_deferrable => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/Test/Deploy.pm view on Meta::CPAN
};
my $bar_relations = {
trees => {
attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
join_type => "LEFT",
},
class => $self->schema_class . "::Result::Tree",
cond => { "foreign.bars_id" => "self.bars_id" },
source => $self->schema_class . "::Result::Tree"
t/lib/Test/Deploy.pm view on Meta::CPAN
};
my $bar_relations = {
trees => {
attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
join_type => "LEFT",
},
class => $self->schema_class . "::Result::Tree",
cond => { "foreign.bars_id" => "self.bars_id" },
source => $self->schema_class . "::Result::Tree"
t/lib/Test/Deploy.pm view on Meta::CPAN
};
my $bar_relations = {
trees => {
attrs => {
accessor => "multi",
cascade_copy => 1,
cascade_delete => 1,
join_type => "LEFT",
},
class => $self->schema_class . "::Result::Tree",
cond => { "foreign.bars_id" => "self.bars_id" },
source => $self->schema_class . "::Result::Tree"
view all matches for this distribution
view release on metacpan or search on metacpan
t/regressions/preferences_table.t view on Meta::CPAN
use YAML::Any qw( LoadFile );
# Needs the following where-clause in the has_many()
# {
# where => { 'me.type' => 'artist' },
# cascade_delete => 0,
# cache_for => 1,
# }
BEGIN {
use loader qw(build_schema);
view all matches for this distribution
view release on metacpan or search on metacpan
t/02-schema-helper-row-definition.t view on Meta::CPAN
my $relationship_info = $schema->Book->result_source->relationship_info('editions');
my $expected_relationship_info = {
'attrs' => {
'accessor' => 'multi',
'cascade_copy' => 1,
'cascade_delete' => 1,
'is_depends_on' => 0,
'join_type' => 'LEFT'
},
'class' => 'TestFor::DBIx::Class::Smooth::Schema::Result::Edition',
'cond' => {
view all matches for this distribution
view release on metacpan or search on metacpan
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"artwork_to_artists",
"CDTest::Schema::Result::ArtworkToArtist",
{ "foreign.artist_id" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 cds
Type: has_many
t/lib/CDTest/Schema/Result/Artist.pm view on Meta::CPAN
__PACKAGE__->has_many(
"cds",
"CDTest::Schema::Result::CD",
{ "foreign.artist" => "self.artistid" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 artwork_cds
Type: many_to_many
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DBIx/Class/CDBICompat/Relationships.pm view on Meta::CPAN
}
if (ref $f_key eq 'HASH' && !$args) { $args = $f_key; undef $f_key; };
$args ||= {};
my $cascade = delete $args->{cascade} || '';
if (delete $args->{no_cascade_delete} || $cascade eq 'None') {
$args->{cascade_delete} = 0;
}
elsif( $cascade eq 'Delete' ) {
$args->{cascade_delete} = 1;
}
elsif( length $cascade ) {
warn "Unemulated cascade option '$cascade' in $class->has_many($rel => $f_class)";
}
if( !$f_key and !@f_method ) {
$class->ensure_class_loaded($f_class);
my $f_source = $f_class->result_source_instance;
view all matches for this distribution