add a mason component for the recent activity page.
[sgn.git] / db / 00156 / AddProjectTypeId.pm
blobaafa5c06645bc864f41cfa35a582e028b96f483b
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddProjectTypeId.pm
8 =head1 SYNOPSIS
10 mx-run ThisPackageName [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 Add type_id foreign key to the Chado project table
18 Based on this commit https://github.com/GMOD/Chado/commit/364ac74f88182bcff07efe5c47d549886645239b
19 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
21 =head1 AUTHOR
23 Naama Menda<nm249@cornell.edu>
25 =head1 COPYRIGHT & LICENSE
27 Copyright 2010 Boyce Thompson Institute for Plant Research
29 This program is free software; you can redistribute it and/or modify
30 it under the same terms as Perl itself.
32 =cut
35 package AddProjectTypeId;
37 use Moose;
38 extends 'CXGN::Metadata::Dbpatch';
41 has '+description' => ( default => <<'' );
42 Add type_id foreign key to the project table as added to the Chado 1.4 release
43 has '+prereq' => (
44 default => sub {
45 [''],
49 sub patch {
50 my $self=shift;
52 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
54 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
56 print STDOUT "\nExecuting the SQL commands.\n";
58 $self->dbh->do(<<EOSQL);
59 --do your SQL here
61 ALTER TABLE project
62 ADD COLUMN type_id bigint REFERENCES cvterm (cvterm_id) ON DELETE SET NULL;
63 CREATE INDEX project_idx1 ON project USING btree (type_id);
64 COMMENT ON COLUMN project.type_id IS 'An optional cvterm_id that specifies what type of project this record is. Prior to 1.4, project type was set with an projectprop.';
66 EOSQL
68 print "You're done!\n";
72 ####
73 1; #
74 ####