closes #297. room for improvement with iframe or species-specific link in future...
[sgn.git] / db / 00017 / AddOrganismComments.pm
blobe1fb2335fb1a4910e5cfc242da6c5cf8e2e9f455
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddOrganismComments
8 =head1 SYNOPSIS
10 mx-run AddOrganismComments [options] -H hostname -D dbname -u username [-F]
12 this is a subclass of L<CXGN::Metadata::Dbpatch>
13 see the perldoc of parent class for more details.
15 =head1 DESCRIPTION
17 Removes unnecessary database constraint.
19 =head1 AUTHOR
21 Lukas Mueller <lam87@cornell.edu>
23 =head1 COPYRIGHT & LICENSE
25 Copyright 2010 Boyce Thompson Institute for Plant Research
27 This program is free software; you can redistribute it and/or modify
28 it under the same terms as Perl itself.
30 =cut
33 package AddOrganismComments;
35 use Moose;
36 extends 'CXGN::Metadata::Dbpatch';
39 has '+description' => ( default => 'Removes unnecessary database constraint.' );
42 has '+prereq' => (
43 default => sub {
44 [],
48 sub patch {
49 my $self=shift;
51 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
53 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
55 print STDOUT "\nExecuting the SQL commands.\n";
57 $self->dbh->do(<<EOSQL);
58 --do your SQL here
61 ALTER TABLE sgn_people.forum_topic DROP CONSTRAINT chk_forum_topic_page_type;
66 EOSQL
68 print "You're done!\n";
72 ####
73 1; #
74 ####
77 # -- ALTER TABLE sgn_people.forum_topic ADD CONSTRAINT chk_forum_topic_page_type CHECK (page_type::text = 'BAC'::text OR page_type::text = 'EST'::text OR page_type::text = 'unigene'::text OR page_type::text = 'marker'::text OR page_type::text = 'map'::text OR page_type::text = 'bac_end'::text OR page_type::text = ''::text OR page_type IS NULL OR page_type::text = 'locus'::text OR page_type::text = 'individual'::text OR page_type::text = 'pub'::text OR page_type::text = 'allele'::text OR page_type::text = 'stock'::text OR page_type::text = 'sample'::text OR page_type::text = 'organism');