6 AddBlastDbBlastDbGroupLinkingTable.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 Lukas Mueller<lam87@cornell.edu>
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 AddBlastDbBlastDbGroupLinkingTable
;
36 extends
'CXGN::Metadata::Dbpatch';
39 has
'+description' => ( default => <<'' );
40 Adds a linking table between the blast_db
and blast_db_group table
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 blast_db_blast_db_group (
62 blast_db_blast_db_group_id serial primary key,
63 blast_db_id bigint REFERENCES blast_db,
64 blast_db_group_id bigint REFERENCES blast_db_group
67 -- populate table with current data from blast_db table
69 insert into sgn.blast_db_blast_db_group (blast_db_id, blast_db_group_id) SELECT blast_db_id, blast_db_group_id FROM sgn.blast_db;
71 -- also add blast_db_organism table
73 create table blast_db_organism (
74 blast_db_organism_id serial primary key,
75 blast_db_id bigint references sgn.blast_db,
76 organism_id bigint references public.organism
79 GRANT select ON sgn.blast_db_organism TO web_usr;
80 GRANT select ON sgn.blast_db_blast_db_group TO web_usr;
85 print "You're done!\n";