From 74a57e153c4cd0205675968b421136898b96b9df Mon Sep 17 00:00:00 2001 From: fduch Date: Thu, 8 Sep 2016 19:24:12 +0300 Subject: [PATCH] add autoincrement primary identifier to jms_job_statistics table in order to avoid statistics duplicates errors --- Entity/Listener/StatisticsListener.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Entity/Listener/StatisticsListener.php b/Entity/Listener/StatisticsListener.php index e25d7c64..a8c8da5f 100644 --- a/Entity/Listener/StatisticsListener.php +++ b/Entity/Listener/StatisticsListener.php @@ -16,10 +16,12 @@ public function postGenerateSchema(GenerateSchemaEventArgs $event) } $table = $schema->createTable('jms_job_statistics'); + $table->addColumn('id', 'bigint', array('nullable' => false, 'unsigned' => true, 'autoincrement' => true)); $table->addColumn('job_id', 'bigint', array('nullable' => false, 'unsigned' => true)); $table->addColumn('characteristic', 'string', array('length' => 30, 'nullable' => false)); $table->addColumn('createdAt', 'datetime', array('nullable' => false)); $table->addColumn('charValue', 'float', array('nullable' => false)); - $table->setPrimaryKey(array('job_id', 'characteristic', 'createdAt')); + $table->setPrimaryKey(array('id')); + $table->addIndex(array('job_id')); } } \ No newline at end of file