Merge pull request #13 from solgenomics/topic/TomDelDb
[phenome.git] / db / AddLocusTableIndexes.pm
blob209b62cfbff8b6fdc860229acef38a57c8547712
1 package AddLocusTableIndexes;
3 use Try::Tiny;
4 use Moose;
5 extends 'CXGN::Metadata::Dbpatch';
7 sub init_patch {
8 my $self=shift;
9 my $name = __PACKAGE__;
10 print "dbpatch name is : '" . $name . "'\n\n";
11 my $description = 'Add missing locus_id indexes to phenome schema.';
12 my @previous_requested_patches = (); #ADD HERE
14 $self->name($name);
15 $self->description($description);
16 $self->prereq(\@previous_requested_patches);
20 sub patch {
21 my $self=shift;
23 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
25 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
27 print STDOUT "\nExecuting the SQL commands.\n";
29 $self->dbh->do(<<EOSQL);
30 create index locus_history_locus_id on phenome.locus_history(locus_id);
31 create index locus_pub_ranking_locus_id on phenome.locus_pub_ranking(locus_id);
32 create index allele_locus_id on phenome.allele(locus_id);
33 create index locus_alias_locus_id on phenome.locus_alias(locus_id);
36 create index locus2locus_subject_id on phenome.locus2locus(subject_id);
37 create index locus2locus_object_id on phenome.locus2locus(object_id);
39 create index individual_locus_locus_id on phenome.individual_locus(locus_id);
40 create index locus_image_locus_id on phenome.locus_image(locus_id);
41 EOSQL
43 print "You're done!\n";
47 return 1;