Result:
found more than 570 distributions - search limited to the first 2001 files matching your query ( run in 2.233 )


DBIx-Class-PgLog

 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


DBIx-Class-Preview

 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


DBIx-Class-RDBOHelpers

 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


DBIx-Class-RandomStringColumns

 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


DBIx-Class-ResultDDL

 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


DBIx-Class-ResultSet-RecursiveUpdate

 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


DBIx-Class-Schema-Diff

 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


DBIx-Class-Schema-Loader-DBI-MariaDB

 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


DBIx-Class-Schema-Loader

 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


DBIx-Class-Schema-Versioned-Inline

 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


DBIx-Class-Sims

 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


DBIx-Class-Smooth

 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


DBIx-Class-Storage-DBI-mysql-Retryable

 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


DBIx-Class-Tree-Mobius

 view release on metacpan or  search on metacpan

lib/DBIx/Class/Tree/Mobius.pm  view on Meta::CPAN

        });

        $class->has_many( '_children' => $1 => {
            "foreign.".$class->_mobius_b_column => "self.".$class->_mobius_a_column,
            "foreign.".$class->_mobius_d_column => "self.".$class->_mobius_c_column,
        }, { cascade_delete => 0 });
      
    }

    Math::BigFloat->accuracy(53); 

 view all matches for this distribution


DBIx-Class-Tree-NestedSet

 view release on metacpan or  search on metacpan

lib/DBIx/Class/Tree/NestedSet.pm  view on Meta::CPAN


        $class->has_many(
            'nodes' => $class,
            \%join_cond,{
                order_by        => "me.$left",
                cascade_delete  => 0,
            },
        );

        $class->has_many(
            'descendants' => $class,
            \%join_cond, {
                where           => \"me.$left > parent.$left AND me.$right < parent.$right",     #"
                order_by        =>  "me.$left",
                from            =>  "$table me, $table parent",
                cascade_delete  => 0,
            },
        );

        $class->has_many(
            'children' => $class,
            \%join_cond, {
                where           => \"me.$left > parent.$left AND me.$right < parent.$right AND me.$level = parent.$level + 1",     #"
                order_by        =>  "me.$left",
                from            =>  "$table me, $table parent",
                cascade_delete  => 0,
            },
        );

        $class->has_many(
            'ancestors' => $class,
            \%join_cond, {
                where           => \"child.$left > me.$left AND child.$right < me.$right",       #"
                order_by        =>  "me.$right",
                from            =>  "$table me, $table child",
                cascade_delete  => 0,
            },
        );

        $class->_tree_columns($args);
    }

 view all matches for this distribution


DBIx-Class-Tree

 view release on metacpan or  search on metacpan

lib/DBIx/Class/Tree/AdjacencyList.pm  view on Meta::CPAN

    if (@_) {
        my $parent_col = shift;
        my $primary_col = ($class->primary_columns())[0];
        $class->belongs_to( '_parent' => $class => { "foreign.$primary_col" => "self.$parent_col" } );
        $class->has_many( 'children' => $class => { "foreign.$parent_col" => "self.$primary_col" } );
        $class->has_many( 'parents' => $class => { "foreign.$primary_col" => "self.$parent_col" }, { cascade_delete => 0, cascade_copy => 0 } );
        $class->_parent_column( $parent_col );
        return 1;
    }
    return $class->_parent_column();
}

 view all matches for this distribution


DBIx-Class-Visualizer

 view release on metacpan or  search on metacpan

lib/DBIx/Class/Visualizer.pm  view on Meta::CPAN

                    "origin_table": "TableName",
                    "origin_column": "a_column_id",
                    "destination_table": "AnotherTableName"
                    "destination_column": "a_column_id",
                    "relation_type": "has_many",
                    "cascade_delete": 1,
                },
                ...
            ],
          }">a_column_id</text>

 view all matches for this distribution


DBIx-DBO2

 view release on metacpan or  search on metacpan

DBO2/Fields.pm  view on Meta::CPAN


=head3 restrict_delete Interface

Identical to the default interface except as follows: an ok_delete hook is installed to check for the existance of any related records, in which case the deletion is cancelled. This prevents you from deleting the "parent" record for a number of relat...

=head3 cascade_delete Interface

Identical to the default interface except as follows: a post_delete hook is installed to delete all of the related records after the parent record is deleted.

=head3 nullify_delete Interface

DBO2/Fields.pm  view on Meta::CPAN

	-params => {
	  delete_default => undef,
	  hook => { post_delete => 'nullify_*' }
	},
      },
      cascade_delete  => { 
	-base => 'default', 
	-params => {
	  hook => { post_delete => 'delete_*' }
	},
      },

 view all matches for this distribution


DBIx-DBStag

 view release on metacpan or  search on metacpan

t/data/chado-cvterm.sql  view on Meta::CPAN

create table db (
    db_id serial not null,
    primary key (db_id),
    name varchar(255) not null,
    contact_id int,
    foreign key (contact_id) references contact (contact_id) on delete cascade INITIALLY DEFERRED,
    description varchar(255) null,
    urlprefix varchar(255) null,
    url varchar(255) null,
    constraint db_c1 unique (name)
);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table dbxref (
    dbxref_id serial not null,
    primary key (dbxref_id),
    db_id int not null,
    foreign key (db_id) references db (db_id) on delete cascade INITIALLY DEFERRED,
    accession varchar(255) not null,
    version varchar(255) not null default '',
    description text,
    constraint dbxref_c1 unique (db_id,accession,version)
);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table cvterm (
    cvterm_id serial not null,
    primary key (cvterm_id),
    cv_id int not null,
    foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
    name varchar(1024) not null,
    definition text,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete set null INITIALLY DEFERRED,
    is_obsolete int not null default 0,

t/data/chado-cvterm.sql  view on Meta::CPAN


create table cvterm_relationship (
    cvterm_relationship_id serial not null,
    primary key (cvterm_relationship_id),
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    subject_id int not null,
    foreign key (subject_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    constraint cvterm_relationship_c1 unique (subject_id,object_id,type_id)
);
COMMENT ON TABLE cvterm_relationship IS
 'A relationship linking two cvterms. A relationship can be thought of
  as an edge in a graph, or as a natural language statement about

t/data/chado-cvterm.sql  view on Meta::CPAN

    cvtermpath_id serial not null,
    primary key (cvtermpath_id),
    type_id int,
    foreign key (type_id) references cvterm (cvterm_id) on delete set null INITIALLY DEFERRED,
    subject_id int not null,
    foreign key (subject_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    object_id int not null,
    foreign key (object_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    cv_id int not null,
    foreign key (cv_id) references cv (cv_id) on delete cascade INITIALLY DEFERRED,
    pathdistance int,
    constraint cvtermpath_c1 unique (subject_id,object_id,type_id,pathdistance)
);
create index cvtermpath_idx1 on cvtermpath (type_id);
create index cvtermpath_idx2 on cvtermpath (subject_id);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table cvtermsynonym (
    cvtermsynonym_id serial not null,
    primary key (cvtermsynonym_id),
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    synonym varchar(1024) not null,
    type_id int,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade  INITIALLY DEFERRED,
    constraint cvtermsynonym_c1 unique (cvterm_id,synonym)
);
create index cvtermsynonym_idx1 on cvtermsynonym (cvterm_id);

-- ================================================

t/data/chado-cvterm.sql  view on Meta::CPAN


create table cvterm_dbxref (
    cvterm_dbxref_id serial not null,
    primary key (cvterm_dbxref_id),
    cvterm_id int not null,
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    is_for_definition int not null default 0,
    constraint cvterm_dbxref_c1 unique (cvterm_id,dbxref_id)
);
create index cvterm_dbxref_idx1 on cvterm_dbxref (cvterm_id);
create index cvterm_dbxref_idx2 on cvterm_dbxref (dbxref_id);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table cvtermprop ( 
    cvtermprop_id serial not null, 
    primary key (cvtermprop_id), 
    cvterm_id int not null, 
    foreign key (cvterm_id) references cvterm (cvterm_id) on delete cascade, 
    type_id int not null, 
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade, 
    value text not null default '', 
    rank int not null default 0,

    unique(cvterm_id, type_id, value, rank) 
);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table organism_dbxref (
    organism_dbxref_id serial not null,
    primary key (organism_dbxref_id),
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
    dbxref_id int not null,
    foreign key (dbxref_id) references dbxref (dbxref_id) on delete cascade INITIALLY DEFERRED,
    constraint organism_dbxref_c1 unique (organism_id,dbxref_id)
);
create index organism_dbxref_idx1 on organism_dbxref (organism_id);
create index organism_dbxref_idx2 on organism_dbxref (dbxref_id);

t/data/chado-cvterm.sql  view on Meta::CPAN


create table organismprop (
    organismprop_id serial not null,
    primary key (organismprop_id),
    organism_id int not null,
    foreign key (organism_id) references organism (organism_id) on delete cascade INITIALLY DEFERRED,
    type_id int not null,
    foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
    value text null,
    rank int not null default 0,
    constraint organismprop_c1 unique (organism_id,type_id,rank)
);
create index organismprop_idx1 on organismprop (organism_id);

 view all matches for this distribution


DBIx-DataModel

 view release on metacpan or  search on metacpan

lib/DBIx/DataModel.pm  view on Meta::CPAN

C<DBIx::DataModel> does not keep track of data mutations
in memory, and therefore provides no support for automatically
propagating changes into the database; the client code has to
explicitly manage C<insert> and C<update> operations.

=item no 'cascaded update' nor 'insert or update'

Cascaded inserts and deletes are supported, but not cascaded updates.
This would need 'insert or update', which is not supported.

=back


 view all matches for this distribution


DBIx-EAV

 view release on metacpan or  search on metacpan

lib/DBIx/EAV.pm  view on Meta::CPAN

    my ( $orig, $class, @args ) = @_;
    my $params = @args == 1 && ref $args[0] ? $args[0] : { @args };
    my $schema_config = delete $params->{schema_config} || {};

    my @schema_params = grep { exists $params->{$_} } qw/
        tenant_id         data_types   database_cascade_delete static_attributes
        table_prefix      id_type      default_attribute_type  enable_multi_tenancy
    /;

    @{$schema_config}{@schema_params} = delete @{$params}{@schema_params};

 view all matches for this distribution


DBIx-MyDatabaseMunger

 view release on metacpan or  search on metacpan

lib/DBIx/MyDatabaseMunger.pm  view on Meta::CPAN

        } elsif( $line =~ m/^\s*
            CONSTRAINT\s+`(.*)`\s+
            FOREIGN\s+KEY\s+\(`(.*)`\)\s+
            REFERENCES\s+`(.*)`\s+\(`(.*)`\)\s+(.*)
        /x ) {
            my($name, $cols, $reftable, $refcols, $cascade_opt) =
                ($1, $2, $3, $4, $5);
            my @cols = split '`,`', $cols;
            my @refcols = split '`,`', $refcols;
            push @constraints, $name;
            $constraint_definition{ $name } = {
                name => $name,
                columns => \@cols,
                reference_table => $reftable,
                reference_columns => \@refcols,
                cascade_opt => $cascade_opt,
            };
        } else {
            warn "Don't understand line in CREATE TABLE:\n$line";
        }
    }

lib/DBIx/MyDatabaseMunger.pm  view on Meta::CPAN

    return "CONSTRAINT `$constraint->{name}` FOREIGN KEY (`"
        . join('`,`', @{$constraint->{columns}})
        . "`) REFERENCES `$constraint->{reference_table}` (`"
        . join('`,`', @{$constraint->{reference_columns}})
        . "`)" . (
            $constraint->{cascade_opt} ? " $constraint->{cascade_opt}" : ''
        );
}

=item $o->queue_add_table_constraint ( $table, $constraint )

 view all matches for this distribution


DBIx-MyParse

 view release on metacpan or  search on metacpan

lib/DBIx/MyParse/Query.pm  view on Meta::CPAN

		return "DROP DATABASE ".$drop_if_exists.$query->getSchemaSelect()->print();
	} elsif ($command eq 'SQLCOM_DROP_TABLE') {
		my $drop_if_exists = $query->getOption("DROP_IF_EXISTS") ? "IF EXISTS " : "";
		my $drop_temporary = $query->getOption("DROP_TEMPORARY") ? "TEMPORARY " : "";
		my $drop_restrict = $query->getOption("DROP_RESTRICT") ? " RESTRICT" : "";
		my $drop_cascade = $query->getOption("DROP_CASCADE") ? " CASCADE" : "";
		return "DROP ".$drop_temporary."TABLE ".$drop_if_exists.join(', ', map { $_->_printTable(0) } @{$query->getTables()}).$drop_restrict.$drop_cascade;
	}
}

sub _printCreate {
	my $query = shift;

 view all matches for this distribution


DBIx-NoSQL-Store-Manager

 view release on metacpan or  search on metacpan

lib/DBIx/NoSQL/Store/Manager/StoreModel.pm  view on Meta::CPAN

    isa => 'Str',
    required => 1,
    predicate => 'has_store_model',
);

has cascade_model => (
    is      => 'ro',
    isa     => 'Bool',
    default => sub { 0 },
);

has cascade_save => (
    is      => 'ro',
    isa     => 'Bool',
    lazy => 1,
    default => sub { $_[0]->cascade_model },
);

has cascade_delete => (
    is      => 'ro',
    isa     => 'Bool',
    lazy => 1,
    default => sub { $_[0]->cascade_model },
);

use Types::Standard qw/ InstanceOf Str HashRef ArrayRef ConsumerOf /;

before _process_options => sub ( $meta, $name, $options ) {

lib/DBIx/NoSQL/Store/Manager/StoreModel.pm  view on Meta::CPAN


    $main_class->add_before_method_modifier( delete => sub ( $self, @) {
        my $obj = $self->$reader or return;

        $_->delete for $array_context ? @$obj : $obj;
    }) if $attr->cascade_delete;

    $main_class->add_before_method_modifier( $attr->get_read_method => sub ( $self, @rest ) {
        return if @rest;

        my $value = $attr->get_value( $self );

lib/DBIx/NoSQL/Store/Manager/StoreModel.pm  view on Meta::CPAN

                ] : $val->store_key;
            }
            return $packed;
    } );

    if( $attr->cascade_save ) {
        $main_class->add_before_method_modifier( 'save' => sub ( $self, $store=undef ) {
                # TODO bug if we remove the value altogether
                my $value = $self->$reader or return;
                
                if ( $attr->cascade_delete ) {
                    my $priors = eval { $self->store_db->get( $self->store_model, $self->store_key )->$reader };

                    if ( $array_context ) {
                        my %priors = map { $_->store_key => $_ } @$priors;
                        for ( @$value ) {

lib/DBIx/NoSQL/Store/Manager/StoreModel.pm  view on Meta::CPAN

    package Blog::Model::Entry;

    has author => (
        traits => [ 'StoreModel' ],
        store_model =>  'Blog::Model::Author',
        cascade_save => 1,
        cascade_delete => 0,
        is => 'rw',
    );

=head1 DESCRIPTION

lib/DBIx/NoSQL/Store/Manager/StoreModel.pm  view on Meta::CPAN


Required. Takes in the model associated with the target attribute.
Will automatically populate the C<isa> attribute to 
C<$model_class|Str_HashRef>.

=head2 cascade_model => $boolean

Sets the default of C<cascade_save> and C<cascade_delete>.
Defaults to C<false>.

=head2 cascade_save => $boolean

If C<true> the object associated with the attribute is automatically saved 
to the store when the main object is C<save()>d.

=head2 cascade_delete => $boolean

If C<true>, deletes the attribute object (if there is any)
from the store when the main object is C<delete()>d.

If both C<cascade_delete> and C<cascade_save> are C<true>,
then when saving the main object, if the attribute object has been
modified, its previous value will be deleted from the store.

    # assuming the author attribute has `cascade_model => 1`...

    my $blog_entry = $store->create( 'Entry', 
        author => Blog::Model::Author->new( 
            name => 'yanick',
            bio  => 'necrohacker',

 view all matches for this distribution


DBIx-ObjectMapper

 view release on metacpan or  search on metacpan

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

        elsif( $status_name eq 'detached' ) {
            my $class_mapper = $self->instance->__class_mapper__;
            for my $prop_name ( $class_mapper->attributes->property_names ) {
                my $prop = $class_mapper->attributes->property_info($prop_name);
                next unless $prop->type eq 'relation';
                if( $prop->{isa}->is_cascade_detach() ) {
                    if( my $instance = $self->get_val($prop_name) ) {
                        my @instance
                            = ref $instance eq 'ARRAY'
                            ? @$instance
                            : ($instance);

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

        elsif( $status_name eq 'expired' ) {
            my $class_mapper = $self->instance->__class_mapper__;
            for my $prop_name ( $class_mapper->attributes->property_names ) {
                my $prop = $class_mapper->attributes->property_info($prop_name);
                next unless $prop->type eq 'relation';
                if( $prop->{isa}->is_cascade_reflesh_expire() ) {
                    if( my $instance = $self->get_val($prop_name) ) {
                        my @instance
                            = ref $instance eq 'ARRAY'
                                ? @$instance
                                    : ($instance);

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

    $self->initialize;

    for my $prop_name ( $class_mapper->attributes->property_names ) {
        my $prop = $class_mapper->attributes->property_info($prop_name);
        next unless $prop->type eq 'relation';
        if( $prop->{isa}->is_cascade_reflesh_expire() ) {
            if( my $instance = $self->get_val($prop_name) ) {
                my @instance
                    = ref $instance eq 'ARRAY'
                    ? @$instance
                    : ($instance);

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

    my $uniq_cond = $self->identity_condition;
    my $class_mapper = $self->instance->__class_mapper__;

    my $result;
    try {
        my @after_cascade;
        for my $prop_name ( $class_mapper->attributes->property_names ) {
            my $prop = $class_mapper->attributes->property_info($prop_name);
            next unless $prop->type eq 'relation';
            if (ref( $prop->{isa} ) eq
                'DBIx::ObjectMapper::Relation::BelongsTo' )
            {
                if ( $prop->{isa}->is_cascade_save_update() ) {
                    $prop->{isa}->cascade_update($self);
                }

                if( $modified_data->{$prop_name} ) {
                    $prop->{isa}->set_val_from_object(
                        $self,
                        $self->get_val($prop_name),
                    );
                }
            }
            elsif ( $prop->{isa}->is_cascade_save_update() ) {
                push @after_cascade, $prop;
            }
        }

        my $new_val;
        if( keys %$modified_data ) {

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

                $reduce_data,
                $modified_data
            );
        }

        for my $c ( @after_cascade ) {
            $c->{isa}->cascade_update( $self );
        }

        $self->_release_many_to_many_event;
        $self->_modify($new_val) if $new_val;
    } catch {

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

    };

    $self->{is_modified} = 0;
    $self->{modified_data} = +{};

    $self->change_status('expired'); # cascade expire if cascade_reflesh_expire
    return !$result || $self->instance;
}

sub save {
    my ( $self ) = @_;

    confess 'it need to be "pending" status.' unless $self->is_pending;
    my $class_mapper = $self->instance->__class_mapper__;

    try {
        my @after_cascade;
        for my $prop_name ( $class_mapper->attributes->property_names ) {
            my $prop = $class_mapper->attributes->property_info($prop_name);
            if ( $prop->type eq 'relation' ) {
                if (ref( $prop->{isa} ) eq
                    'DBIx::ObjectMapper::Relation::BelongsTo' )

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

                        my @instances
                            = ref $instance eq 'ARRAY'
                            ? @$instance
                            : ($instance);
                        for my $i (@instances) {
                            if( $prop->{isa}->is_cascade_save_update() ) {
                                $prop->{isa}->cascade_save( $self, $i );
                            }
                            else {
                                $prop->{isa}->set_val_from_object( $self, $i );
                            }
                        }
                    }
                }
                elsif( $prop->{isa}->is_cascade_save_update() ) {
                    push @after_cascade, $prop;
                }
            }
        }

        my $reduce_data = $self->reducing;
        my $data = { %$reduce_data, %{$class_mapper->default_value} };
        my $comp_result = $class_mapper->insert(%$data);
        $self->_modify($comp_result);
        $self->initialize;

        for my $c ( @after_cascade ) {
            if ( my $instance = $self->get_val($c->name) ) {
                my @instances
                    = ref $instance eq 'ARRAY'
                    ? @$instance
                    : ($instance);
                for my $i (@instances) {
                    $c->{isa}->cascade_save( $self, $i );
                }
            }
        }

    } catch {

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

    my $uniq_cond = $self->identity_condition;
    my $class_mapper = $self->instance->__class_mapper__;

    my $result;
    try {
        my @after_cascade;
        $deleted_key->{$self->primary_cache_key} = 1;
        for my $prop_name ( $class_mapper->attributes->property_names ) {
            my $prop = $class_mapper->attributes->property_info($prop_name);
            if (    $prop->type eq 'relation'
                and $prop->{isa}->is_cascade_delete() )
            {
                if (ref( $prop->{isa} ) eq
                    'DBIx::ObjectMapper::Relation::BelongsTo' )
                {
                    push @after_cascade, $prop;
                }
                else {
                    $self->_cascade_delete($prop, $deleted_key);
                }
            }
            elsif( $prop->is_multi ) {
                $prop->{isa}->deleted_parent($self);
            }
        }

        $result = $class_mapper->delete(@$uniq_cond);

        for my $c ( @after_cascade ) {
            $self->_cascade_delete($c, $deleted_key);
        }
    } catch {
        $self->change_status('detached');
        confess $_[0];
    };

    $self->change_status('detached');
    return $result;
}

sub _cascade_delete {
    my ( $self, $prop, $deleted_key ) = @_;

    $prop->{isa}->cascade_delete($self, $deleted_key);
    if ( my $instance = $self->get_val($prop->name) ) {
        my @instance
            = ref $instance eq 'ARRAY'
            ? @$instance
            : ($instance);

lib/DBIx/ObjectMapper/Mapper/Instance.pm  view on Meta::CPAN

    {
        my $mapper_addr  = refaddr($obj);
        $self->_regist_many_to_many_event($name, $mapper_addr, 'remove');
    }
    elsif( $self->is_persistent ) {
        if( $prop->{isa}->is_cascade_delete_orphan ) {
            $self->unit_of_work->delete($obj);
        }
        else {
            my $rel_val = $prop->{isa}->relation_value($self);
            for my $r ( keys %$rel_val ) {

 view all matches for this distribution


DBIx-OnlineDDL

 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


DBIx-Patcher

 view release on metacpan or  search on metacpan

lib/DBIx/Patcher/Schema/Result/Patcher/Run.pm  view on Meta::CPAN


__PACKAGE__->has_many(
  "patches",
  "DBIx::Patcher::Schema::Result::Patcher::Patch",
  { "foreign.run_id" => "self.id" },
  { cascade_copy => 0, cascade_delete => 0 },
);


# Created by DBIx::Class::Schema::Loader v0.07002 @ 2011-02-19 15:51:40
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Daqwau9crznJbGFbcJhF3Q

 view all matches for this distribution


DBIx-PgLink

 view release on metacpan or  search on metacpan

lib/DBIx/PgLink/Accessor/BaseAccessor.pm  view on Meta::CPAN

  {isa=>'Int', required=>1},
) => sub {
  my ($self, $object_id) = @_;

  # delete base row by id
  # foreign key cascade to child metadata (columns, queries, etc)
  pg_dbh->do(<<'END_OF_SQL',
DELETE FROM dbix_pglink.objects
WHERE object_id = $1
END_OF_SQL
    {types=>[qw/INT4/]},

 view all matches for this distribution


DBIx-QuickORM

 view release on metacpan or  search on metacpan

lib/DBIx/QuickORM.pm  view on Meta::CPAN


    my $pg_orm    = orm('my_orm:pgsql');
    my $mysql_orm = orm('my_orm:mysql');

This works in C<orm()>, C<db()>, C<schema()>, C<table()>, and C<row()> builders. It does
cascade, so if you ask for the C<mysql> variant of an ORM, it will also give you
the C<mysql> variants of the database, schema, tables and rows.

Can be nested under any builder. Can contain whatever the builder it is nested
under can contain.

 view all matches for this distribution


DBIx-Schema-DSL

 view release on metacpan or  search on metacpan

t/002_dsl.t  view on Meta::CPAN

    varchar 'name', null => 0;
    integer 'author_id';
    decimal 'price', size => [4,2];
    enum    'classification', [qw/novel science/];

    belongs_to 'author', on_delete => 'cascade';
};

create_table author => columns {
    pk      'id';
    varchar 'name';

t/002_dsl.t  view on Meta::CPAN


ok $c->no_fk_translate;
ok my $ddl = $c->translate;
note $ddl;

like $ddl, qr/ON DELETE cascade/msi;
like $ddl, qr/on update CURRENT_TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP/msi;
like $ddl, qr/`classification` ENUM\('novel', 'science'\) NULL/msi;

ok $c->no_fk_translate ne $c->translate;

 view all matches for this distribution


( run in 2.233 seconds using v1.01-cache-2.11-cpan-e93a5daba3e )