1 package AddFeatureCvtermRank
;
4 extends
'CXGN::Metadata::Dbpatch';
6 use Bio
::Chado
::Schema
;
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
15 $self->description($description);
16 $self->prereq(\
@previous_requested_patches);
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";