RunCommandLogs: set a UUID automatically

This commit is contained in:
Graham Christensen
2022-01-24 11:56:34 -05:00
committed by Cole Helbling
parent 89e8676d80
commit dcb0c1425c
2 changed files with 27 additions and 0 deletions

View File

@ -174,9 +174,30 @@ __PACKAGE__->belongs_to(
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZVpYU6k3d/k/nitjpdgf/A
use POSIX qw(WEXITSTATUS WIFEXITED WIFSIGNALED WTERMSIG);
use UUID4::Tiny qw(create_uuid_string);
use Digest::SHA1 qw(sha1_hex);
use Hydra::Model::DB;
=head2 new
Initialize a new row object.
Sets the UUID automatically unless a UUID is specified in the attributes.
=cut
sub new {
my ($class, $attrs) = @_;
if (!defined $attrs->{uuid}) {
$attrs->{uuid} = create_uuid_string();
}
my $new = $class->next::method($attrs);
return $new;
}
=head2 started
Update the row with the current timestamp as the start time.