10 mx-run AddComposedTraitCv [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.
17 Adds a composed trait cv with namespace COMP to allow composition of traits
18 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
22 Bryan Ellerbrock<bje24@cornell.edu>
24 =head1 COPYRIGHT & LICENSE
26 Copyright 2011 Boyce Thompson Institute for Plant Research
28 This program is free software; you can redistribute it and/or modify
29 it under the same terms as Perl itself.
34 package AddComposedTraitCv
;
37 extends
'CXGN::Metadata::Dbpatch';
40 has
'+description' => ( default => <<'' );
41 Adds a composed trait cv with namespace COMP to allow composition of traits
47 print STDOUT
"Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
49 print STDOUT
"\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
51 print STDOUT
"\nExecuting the SQL commands.\n";
53 $self->dbh->do(<<EOSQL);
57 -- add cv and db for composed traits
59 INSERT into db (name) values ('COMP');
60 CREATE SEQUENCE composed_trait_ids;
61 ALTER SEQUENCE composed_trait_ids OWNER TO web_usr;
62 GRANT ALL ON cvterm_relationship to web_usr;
63 GRANT ALL ON cvterm_relationship_cvterm_relationship_id_seq to web_usr;
64 GRANT ALL ON cvtermsynonym to web_usr;
65 GRANT ALL ON cvtermsynonym_cvtermsynonym_id_seq to web_usr;
66 INSERT into cv (name) values ('composed_trait');
67 INSERT into dbxref (db_id, accession) select db_id, nextval('composed_trait_ids') from db where name = 'COMP';
68 INSERT into cvterm (cv_id,name,dbxref_id) select cv_id, 'Composed traits', dbxref_id from cv join db on true AND db.name = 'COMP' join dbxref using(db_id) where cv.name = 'composed_trait';
72 print "You're done!\n";