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.
17 Create new phenotypeprop table nad grant web_usr permission
18 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
22 Naama Menda<nm249@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 CreatePhenProp
;
37 extends
'CXGN::Metadata::Dbpatch';
40 has
'+description' => ( default => <<'' );
41 Create new phenotypeprop table nad grant web_usr permission
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);
55 set search_path to public;
56 create table phenotypeprop (
57 phenotypeprop_id serial not null,
58 primary key (phenotypeprop_id),
59 phenotype_id int not null,
60 foreign key (phenotype_id) references phenotype (phenotype_id) on delete cascade INITIALLY DEFERRED,
62 foreign key (type_id) references cvterm (cvterm_id) on delete cascade INITIALLY DEFERRED,
64 rank int not null default 0,
65 constraint phenotypeprop_c1 unique (phenotype_id,type_id,rank)
67 create index phenotypeprop_idx1 on phenotypeprop (phenotype_id);
68 create index phenotypeprop_idx2 on phenotypeprop (type_id);
70 COMMENT ON TABLE phenotypeprop IS 'A phenotype can have any number of
71 slot-value property tags attached to it. This is an alternative to
72 hardcoding a list of columns in the relational schema, and is
73 completely extensible. There is a unique constraint, phenotypeprop_c1, for
74 the combination of phenotype_id, rank, and type_id. Multivalued property-value pairs must be differentiated by rank.';
77 GRANT all ON phenotypeprop TO web_usr;
78 GRANT usage ON phenotypeprop_phenotypeprop_id_seq TO web_usr;
82 print "You're done!\n";