6 AddFilesStockLinkingTable.pm
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 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
21 Mirella Flores <mrf252@cornell.edu>
23 =head1 COPYRIGHT & LICENSE
25 Copyright 2023 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 AddFilesStockLinkingTable
;
36 extends
'CXGN::Metadata::Dbpatch';
39 has
'+description' => ( default => <<'' );
40 Adds the linking table between files
and stock to Phenome
51 print STDOUT
"Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
53 print STDOUT
"\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
55 print STDOUT
"\nExecuting the SQL commands.\n";
57 $self->dbh->do(<<EOSQL);
61 CREATE TABLE phenome.stock_file (
62 stock_file_id serial primary key,
63 stock_id int4 NOT NULL REFERENCES stock ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
64 file_id int4 NOT NULL REFERENCES metadata.md_files ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
67 GRANT UPDATE, INSERT, SELECT ON phenome.stock_file TO web_usr;
68 GRANT USAGE ON phenome.stock_file_stock_file_id_seq to web_usr;
72 print "You're done!\n";