6 DefaultMdImageCreateDateTimestamp.pm
10 mx-run DefaultMdImageCreateDateTimestamp [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 sets a default NOW() value for the create_date and modified_date columns in metadata.md_images, metadata.md_tag_image, and metadata.md_tag
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 DefaultMdImageCreateDateTimestamp
;
37 extends
'CXGN::Metadata::Dbpatch';
39 has
'+description' => ( default => <<'');
40 This patch sets a
default NOW
() value
for the create_date
and modified_date columns
in metadata
.md_images
, metadata
.md_tag_image
, and metadata
.md_tag
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";
58 $self->dbh->do(<<EOSQL);
62 alter table metadata.md_image alter column create_date set default now();
63 alter table metadata.md_image alter column modified_date set default now();
64 alter table metadata.md_tag_image alter column create_date set default now();
65 alter table metadata.md_tag_image alter column modified_date set default now();
66 alter table metadata.md_tag alter column create_date set default now();
67 alter table metadata.md_tag alter column modified_date set default now();
71 print "You're done!\n";