From 1fed24236471fad32b48bc8c4ded68a88130889e Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 4 Oct 2022 21:06:42 +0100 Subject: [PATCH] store times as numerics, not floats floats are inexact: https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT numeric are exact: https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL --- src/Storage/Doctrine/Connection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Storage/Doctrine/Connection.php b/src/Storage/Doctrine/Connection.php index fa812b9..3415c42 100644 --- a/src/Storage/Doctrine/Connection.php +++ b/src/Storage/Doctrine/Connection.php @@ -176,10 +176,10 @@ private function addTableToSchema(Schema $schema): void $table->addColumn('id', Types::INTEGER)->setNotnull(true)->setAutoincrement(true); $table->addColumn('message_uid', Types::GUID)->setNotnull(true); $table->addColumn('class', Types::STRING)->setLength(255)->setNotnull(true); - $table->addColumn('dispatched_at', Types::FLOAT)->setNotnull(true); - $table->addColumn('waiting_time', Types::FLOAT)->setNotnull(false); - $table->addColumn('handling_time', Types::FLOAT)->setNotnull(false); - $table->addColumn('failing_time', Types::FLOAT)->setNotnull(false); + $table->addColumn('dispatched_at', Types::DECIMAL, ['precision' => 16, 'scale' => 6])->setNotnull(true); + $table->addColumn('waiting_time', Types::DECIMAL, ['precision' => 16, 'scale' => 6])->setNotnull(false); + $table->addColumn('handling_time', Types::DECIMAL, ['precision' => 16, 'scale' => 6])->setNotnull(false); + $table->addColumn('failing_time', Types::DECIMAL, ['precision' => 16, 'scale' => 6])->setNotnull(false); $table->addColumn('receiver_name', Types::STRING)->setLength(255)->setNotnull(false); $table->addIndex(['dispatched_at']); $table->addIndex(['class']);