fix typo.
[sgn.git] / db / 00056 / AddMdImageCvtermTable.pm
blobee100df73bc41446f20e5bd8f1b644860df58b74
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddMdImageCvtermTable.pm
8 =head1 SYNOPSIS
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.
15 =head1 DESCRIPTION
17 This subclass uses L<Moose>. The parent class uses L<MooseX::Runnable>
19 =head1 AUTHOR
21 Naama Menda<nm249@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.
30 =cut
33 package AddMdImageCvtermTable;
35 use Moose;
36 extends 'CXGN::Metadata::Dbpatch';
39 has '+description' => ( default => <<'' );
40 Adds a linking table between the metadata.md_image and cvterm table
42 has '+prereq' => (
43 default => sub {
44 [ ],
48 sub patch {
49 my $self=shift;
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);
58 --do your SQL here
61 CREATE TABLE metadata.md_image_cvterm (
62 md_image_cvterm_id serial primary key,
63 image_id bigint REFERENCES metadata.md_image(image_id) NOT NULL,
64 cvterm_id bigint REFERENCES cvterm(cvterm_id) NOT NULL,
65 sp_person_id bigint REFERENCES sgn_people.sp_person(sp_person_id),
66 obsolete boolean DEFAULT false
70 GRANT select,insert ON metadata.md_image_cvterm TO web_usr;
71 GRANT USAGE ON metadata.md_image_cvterm_md_image_cvterm_id_seq to web_usr;
73 EOSQL
75 print "You're done!\n";
79 ####
80 1; #
81 ####