X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FDB%2FResult%2FBugBlock.pm;h=0200a313657d0fe0c4996ddf8960039aa9c91f8a;hb=466f7faff129a5699c7674f59900a92aa256175d;hp=074b29b06ab1290426c7dc7d303a5495ff28ce18;hpb=6091f73ce65064a2876ba44253a6335e5208f3d9;p=debbugs.git diff --git a/Debbugs/DB/Result/BugBlock.pm b/Debbugs/DB/Result/BugBlock.pm index 074b29b..0200a31 100644 --- a/Debbugs/DB/Result/BugBlock.pm +++ b/Debbugs/DB/Result/BugBlock.pm @@ -6,7 +6,7 @@ package Debbugs::DB::Result::BugBlock; =head1 NAME -Debbugs::DB::Result::BugBlock +Debbugs::DB::Result::BugBlock - Bugs which block other bugs =cut @@ -21,11 +21,13 @@ use base 'DBIx::Class::Core'; =item * L +=item * L + =back =cut -__PACKAGE__->load_components("InflateColumn::DateTime"); +__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp"); =head1 TABLE: C @@ -35,34 +37,64 @@ __PACKAGE__->table("bug_blocks"); =head1 ACCESSORS -=head2 bug_id +=head2 id + + data_type: 'integer' + is_auto_increment: 1 + is_nullable: 0 + sequence: 'bug_blocks_id_seq' + +=head2 bug data_type: 'integer' is_foreign_key: 1 is_nullable: 0 +Bug number + =head2 blocks data_type: 'integer' is_foreign_key: 1 is_nullable: 0 +Bug number which is blocked by bug + =cut __PACKAGE__->add_columns( - "bug_id", + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "bug_blocks_id_seq", + }, + "bug", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, "blocks", { data_type => "integer", is_foreign_key => 1, is_nullable => 0 }, ); +=head1 PRIMARY KEY + +=over 4 + +=item * L + +=back + +=cut + +__PACKAGE__->set_primary_key("id"); + =head1 UNIQUE CONSTRAINTS =head2 C =over 4 -=item * L +=item * L =item * L @@ -70,7 +102,7 @@ __PACKAGE__->add_columns( =cut -__PACKAGE__->add_unique_constraint("bug_blocks_bug_id_blocks_idx", ["bug_id", "blocks"]); +__PACKAGE__->add_unique_constraint("bug_blocks_bug_id_blocks_idx", ["bug", "blocks"]); =head1 RELATIONS @@ -86,7 +118,7 @@ __PACKAGE__->belongs_to( "block", "Debbugs::DB::Result::Bug", { id => "blocks" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, ); =head2 bug @@ -100,14 +132,21 @@ Related object: L __PACKAGE__->belongs_to( "bug", "Debbugs::DB::Result::Bug", - { id => "bug_id" }, - { is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" }, + { id => "bug" }, + { is_deferrable => 0, on_delete => "NO ACTION", on_update => "NO ACTION" }, ); -# Created by DBIx::Class::Schema::Loader v0.07025 @ 2012-07-17 10:25:29 -# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:adv4v35ZqedSG4L0CFNPMg +# Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-11-30 21:56:51 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Rkt0XlA4r2YFX0KnUZmS6A + +sub sqlt_deploy_hook { + my ($self, $sqlt_table) = @_; + for my $idx (qw(bug blocks)) { + $sqlt_table->add_index(name => 'bug_blocks_'.$idx.'_idx', + fields => [$idx]); + } +} -# You can replace this text with custom code or comments, and it will be preserved on regeneration 1;