Pass along stock type info to trials.mas to hide analysis usage table in non-accessio...
[sgn.git] / db / 00006 / AddFeatureCvtermRank.pm
blob8493282ec3b94da15ec19ca7abd6fa7140fb75be
1 package AddFeatureCvtermRank;
3 use Moose;
4 extends 'CXGN::Metadata::Dbpatch';
6 use Bio::Chado::Schema;
8 sub init_patch {
9 my $self=shift;
10 my $name = __PACKAGE__;
11 print "dbpatch name is ':" . $name . "\n\n";
12 my $description = 'Adding rank column to feature_cvterm table';
13 my @previous_requested_patches = (); #ADD HERE
14 $self->name($name);
15 $self->description($description);
16 $self->prereq(\@previous_requested_patches);
19 sub patch {
20 my $self=shift;
22 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
24 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
26 print STDOUT "\nExecuting the SQL commands.\n";
28 $self->dbh->do( <<'' );
29 alter table public.feature_cvterm add rank integer not null default 0;
30 alter table public.feature_cvterm drop constraint feature_cvterm_c1;
31 alter table public.feature_cvterm add constraint feature_cvterm_c1 unique ( feature_id, cvterm_id, pub_id, rank );
33 print "You're done!\n";
38 ####
39 1; #
40 ####