Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / db / 00149 / AddSeedlotMaintenanceType.pm
blob0b937ea4a57066f5e92dadcee5f38825289cdd8f
1 #!/usr/bin/env perl
4 =head1 NAME
6 AddSeedlotMaintenanceType.pm
8 =head1 SYNOPSIS
10 mx-run AddSeedlotMaintenanceType [options] -H hostname -D dbname -u username [-F]
12 =head1 DESCRIPTION
14 This patch adds the cvterm 'seedlot_maintenance_json' to the 'stock_property' cv
16 =head1 AUTHOR
18 David Waring <djw64@cornell.edu>
20 =head1 COPYRIGHT & LICENSE
22 Copyright 2010 Boyce Thompson Institute for Plant Research
24 This program is free software; you can redistribute it and/or modify
25 it under the same terms as Perl itself.
27 =cut
30 package AddSeedlotMaintenanceType;
32 use Moose;
33 use Bio::Chado::Schema;
34 use Try::Tiny;
35 extends 'CXGN::Metadata::Dbpatch';
37 has '+description' => ( default => <<'' );
38 This patch adds the cvterm 'seedlot_maintenance_json' to the 'stock_property' cv
40 has '+prereq' => (
41 default => sub {
42 [],
46 sub patch {
47 my $self=shift;
49 print STDOUT "Executing the patch:\n " . $self->name . ".\n\nDescription:\n ". $self->description . ".\n\nExecuted by:\n " . $self->username . " .";
51 print STDOUT "\nChecking if this db_patch was executed before or if previous db_patches have been executed.\n";
53 print STDOUT "\nExecuting the SQL commands.\n";
55 my $schema = Bio::Chado::Schema->connect( sub { $self->dbh->clone } );
56 my $term = 'seedlot_maintenance_json';
57 $schema->resultset("Cv::Cvterm")->create_with({
58 name => $term,
59 cv => 'stock_property'
60 });
62 print "You're done!\n";
66 ####
67 1; #
68 ####