add legend
[sgn.git] / db / 00010 / AddForumPageTypes.pm
blob4ff9e8ac15aa3cbae5e09a2d2e74a71727e618c0
1 package AddForumPageTypes;
3 use Moose;
4 extends 'CXGN::Metadata::Dbpatch';
6 sub init_patch {
8 my $self=shift;
9 my $name = __PACKAGE__;
10 print "dbpatch name is ':" . $name . "\n\n";
11 my $description = 'Adding needed page types to sgn.forum_topic';
12 my @previous_requested_patches = (); #ADD HERE
13 $self->name($name);
14 $self->description($description);
15 $self->prereq(\@previous_requested_patches);
18 sub patch {
19 my $self=shift;
21 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
23 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
25 print STDOUT "\nExecuting the SQL commands.\n";
27 $self->dbh->do( <<EOF );
28 ALTER TABLE sgn_people.forum_topic DROP CONSTRAINT chk_forum_topic_page_type;
29 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) ;
31 EOF
33 print "You're done!\n";
37 ####
38 1; #
39 ####