From c3a323eb11c945b58ceebc759bfa93e45431b2a7 Mon Sep 17 00:00:00 2001 From: Vladimir Tsykun Date: Wed, 31 Jan 2018 23:18:35 +0300 Subject: [PATCH] Fix unable to install on mysql. Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key --- .../Schema/OkvpnMQInsightBundleInstaller.php | 2 + .../Schema/v1_0/OkvpnMQInsightBundle.php | 38 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/Migrations/Schema/OkvpnMQInsightBundleInstaller.php b/src/Migrations/Schema/OkvpnMQInsightBundleInstaller.php index ca84b76..7de00cb 100644 --- a/src/Migrations/Schema/OkvpnMQInsightBundleInstaller.php +++ b/src/Migrations/Schema/OkvpnMQInsightBundleInstaller.php @@ -46,6 +46,7 @@ public function up(Schema $schema, QueryBag $queries) $table->addColumn('added', Type::INTEGER); $table->addColumn('removed', Type::INTEGER); $table->addColumn('channel', Type::STRING, ['notnull' => false, 'length' => 32]); + $table->setPrimaryKey(['id']); $table = $schema->createTable('okvpn_mq_error_stat'); $table->addColumn('id', Type::INTEGER, ['autoincrement' => true]); @@ -53,5 +54,6 @@ public function up(Schema $schema, QueryBag $queries) $table->addColumn('processor_name', Type::STRING, ['notnull' => false, 'length' => 255]); $table->addColumn('message_id', Type::STRING, ['notnull' => false, 'length' => 255]); $table->addColumn('log', Type::TEXT, ['notnull' => false, 'length' => 255]); + $table->setPrimaryKey(['id']); } } diff --git a/src/Migrations/Schema/v1_0/OkvpnMQInsightBundle.php b/src/Migrations/Schema/v1_0/OkvpnMQInsightBundle.php index 0292fa0..9974406 100644 --- a/src/Migrations/Schema/v1_0/OkvpnMQInsightBundle.php +++ b/src/Migrations/Schema/v1_0/OkvpnMQInsightBundle.php @@ -3,13 +3,10 @@ namespace Okvpn\Bundle\MQInsightBundle\Migrations\Schema; use Doctrine\DBAL\Schema\Schema; +use Doctrine\DBAL\Types\Type; use Oro\Bundle\MigrationBundle\Migration\Migration; use Oro\Bundle\MigrationBundle\Migration\QueryBag; -/** - * @SuppressWarnings(PHPMD.TooManyMethods) - * @SuppressWarnings(PHPMD.ExcessiveClassLength) - */ class OkvpnMQInsightBundle implements Migration { /** @@ -17,5 +14,38 @@ class OkvpnMQInsightBundle implements Migration */ public function up(Schema $schema, QueryBag $queries) { + $table = $schema->createTable('okvpn_mq_state_stat'); + $table->addColumn('id', Type::INTEGER, ['autoincrement' => true]); + $table->addColumn('created', Type::DATETIME); + $table->addColumn('queue', Type::INTEGER); + $table->setPrimaryKey(['id']); + + $table = $schema->createTable('okvpn_mq_processor_stat'); + $table->addColumn('id', Type::INTEGER, ['autoincrement' => true]); + $table->addColumn('created', Type::DATETIME); + $table->addColumn('name', Type::STRING, ['length' => 255]); + $table->addColumn('avg_time', Type::DECIMAL, ['scale' => 3, 'precision' => 7, 'notnull' => false]); + $table->addColumn('max_time', Type::DECIMAL, ['scale' => 3, 'precision' => 7, 'notnull' => false]); + $table->addColumn('min_time', Type::DECIMAL, ['scale' => 3, 'precision' => 7, 'notnull' => false]); + $table->addColumn('ack', Type::INTEGER); + $table->addColumn('reject', Type::INTEGER); + $table->addColumn('requeue', Type::INTEGER); + $table->setPrimaryKey(['id']); + + $table = $schema->createTable('okvpn_mq_change_stat'); + $table->addColumn('id', Type::INTEGER, ['autoincrement' => true]); + $table->addColumn('created', Type::DATETIME); + $table->addColumn('added', Type::INTEGER); + $table->addColumn('removed', Type::INTEGER); + $table->addColumn('channel', Type::STRING, ['notnull' => false, 'length' => 32]); + $table->setPrimaryKey(['id']); + + $table = $schema->createTable('okvpn_mq_error_stat'); + $table->addColumn('id', Type::INTEGER, ['autoincrement' => true]); + $table->addColumn('created', Type::DATETIME); + $table->addColumn('processor_name', Type::STRING, ['notnull' => false, 'length' => 255]); + $table->addColumn('message_id', Type::STRING, ['notnull' => false, 'length' => 255]); + $table->addColumn('log', Type::TEXT, ['notnull' => false, 'length' => 255]); + $table->setPrimaryKey(['id']); } }