X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData%2FResult%2FContestProblem.pm;h=fd720add20ca7650dd5cb7521543424f0c4e4b5d;hb=78c794d653161038dd4ef5986d7c7a5b96baff82;hp=a1fe4b43a3de39d8684129760662f6b9562c9457;hpb=4ed3f8e7c64594bb4ea26abb1c4fb51a5a8258d6;p=gruntmaster-data.git diff --git a/lib/Gruntmaster/Data/Result/ContestProblem.pm b/lib/Gruntmaster/Data/Result/ContestProblem.pm index a1fe4b4..fd720ad 100644 --- a/lib/Gruntmaster/Data/Result/ContestProblem.pm +++ b/lib/Gruntmaster/Data/Result/ContestProblem.pm @@ -6,7 +6,7 @@ package Gruntmaster::Data::Result::ContestProblem; =head1 NAME -Gruntmaster::Data::Result::ContestProblem +Gruntmaster::Data::Result::ContestProblem - Many-to-many bridge between contests and problems =cut @@ -72,7 +72,7 @@ __PACKAGE__->belongs_to( "contest", "Gruntmaster::Data::Result::Contest", { id => "contest" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); =head2 problem @@ -87,13 +87,39 @@ __PACKAGE__->belongs_to( "problem", "Gruntmaster::Data::Result::Problem", { id => "problem" }, - { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, + { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, ); -# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-03-06 12:41:16 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2vVP0Z6QcLz8DiobdOceyQ +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:44:22 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dTFBC3ZKB2T9SCiyQxxe2w +use Class::Method::Modifiers qw/after/; + +sub rawcontest { shift->get_column('contest') } +sub rawproblem { shift->get_column('problem') } + +after qw/insert update delete/ => sub { + my ($self) = @_; + Gruntmaster::Data::purge '/pb/'; + Gruntmaster::Data::purge '/pb/' . $self->rawproblem; +}; -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1; + +__END__ + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself, either Perl version 5.18.1 or, +at your option, any later version of Perl 5 you may have available. + + +=cut