6 CreateFeaturepropJSONTable.pm
10 mx-run CreateFeaturepropJSONTable [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 This patch creates the featureprop_json table used for storing sequence metadata as JSON objects
18 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
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.
33 package CreateFeaturepropJSONTable
;
37 extends
'CXGN::Metadata::Dbpatch';
39 has
'+description' => ( default => <<'');
40 This patch creates the featureprop_json table used
for storing sequence metadata as JSON objects
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";
60 $self->dbh->do(<<EOSQL);
63 CREATE TABLE IF NOT EXISTS public.featureprop_json (
64 "featureprop_json_id" SERIAL PRIMARY KEY,
65 "feature_id" int8 REFERENCES feature,
66 "type_id" int8 REFERENCES cvterm,
67 "nd_protocol_id" int8 REFERENCES nd_protocol,
74 CREATE INDEX feaureprop_json_idx1 ON featureprop_json(feature_id);
75 CREATE INDEX feaureprop_json_idx2 ON featureprop_json(type_id);
76 CREATE INDEX feaureprop_json_idx3 ON featureprop_json(nd_protocol_id);
77 CREATE INDEX feaureprop_json_idx4 ON featureprop_json(start_pos);
78 CREATE INDEX feaureprop_json_idx5 ON featureprop_json(end_pos);
80 -- grant usage to web_usr
81 GRANT ALL on public.featureprop_json to web_usr;
82 GRANT USAGE ON public.featureprop_json_featureprop_json_id_seq to web_usr;
86 print "You're done!\n";