TT#5559 events datetime inflate

+ fix writing hires seconds

Change-Id: I6f7f19b05c0a068c8cb7c349d5ddb263a6c5859d
changes/28/9828/5
Rene Krenn 9 years ago
parent fd3f6c6627
commit 2c2b1961e1

@ -43,7 +43,7 @@ sub _deflate_from_datetime {
unless $info->{data_type} eq "decimal" unless $info->{data_type} eq "decimal"
|| (exists $info->{inflate_datetime} || (exists $info->{inflate_datetime}
&& $info->{inflate_datetime} eq 'epoch_micro'); && $info->{inflate_datetime} eq 'epoch_micro');
return $value->epoch; return $value->hires_epoch;
} }
1; 1;

@ -43,7 +43,7 @@ sub _deflate_from_datetime {
unless $info->{data_type} eq "decimal" unless $info->{data_type} eq "decimal"
|| (exists $info->{inflate_datetime} || (exists $info->{inflate_datetime}
&& $info->{inflate_datetime} eq 'epoch_milli'); && $info->{inflate_datetime} eq 'epoch_milli');
return $value->epoch; return $value->hires_epoch;
} }
1; 1;

@ -8,6 +8,7 @@ our $VERSION = '2.007';
__PACKAGE__->load_components( __PACKAGE__->load_components(
"InflateColumn::DateTime", "InflateColumn::DateTime",
"Helper::Row::ToJSON", "Helper::Row::ToJSON",
"+NGCP::Schema::InflateColumn::DateTime::EpochMilli",
); );
__PACKAGE__->table("accounting.events"); __PACKAGE__->table("accounting.events");
@ -31,7 +32,7 @@ __PACKAGE__->add_columns(
"new_status", "new_status",
{ data_type => "varchar", is_nullable => 0, size => 255 }, { data_type => "varchar", is_nullable => 0, size => 255 },
"timestamp", "timestamp",
{ data_type => "decimal", is_nullable => 0, size => [13, 3] }, { data_type => "decimal", is_nullable => 0, size => [13, 3], inflate_datetime => 'epoch_milli' },
"export_status", "export_status",
{ {
data_type => "enum", data_type => "enum",
@ -49,6 +50,7 @@ __PACKAGE__->add_columns(
__PACKAGE__->set_primary_key("id"); __PACKAGE__->set_primary_key("id");
sub TO_JSON { sub TO_JSON {
my ($self) = @_; my ($self) = @_;
return { return {

Loading…
Cancel
Save