Merge branch 'master' into topic/upload_fieldbook_images
[sgn.git] / db / 00003 / AddSFSIndex.pm
blob76bd79a23412f8a23990ac95401ffe49e1c96232
1 package AddSFSIndex;
3 use Try::Tiny;
4 use Moose;
5 use 5.010;
6 extends 'CXGN::Metadata::Dbpatch';
8 sub init_patch {
9 my $self=shift;
10 my $name = __PACKAGE__;
11 say "dbpatch name $name";
12 my $description = 'Add missing indexes';
13 my @previous_requested_patches = ();
14 $self->name($name);
15 $self->description($description);
16 $self->prereq(\@previous_requested_patches);
19 sub patch {
20 my $self=shift;
21 say "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
22 say "Checking if this db_patch was executed before or if previous db_patches have been executed.\n";
23 say "Executing the SQL commands.\n";
25 my $sql = <<SQL;
26 create index lowername on name(lower(name));
27 SQL
29 $self->dbh->do($sql);
30 say "Have a nice day!";