Fix fatal error table already created "plugin_ims_lti_tool"

pull/2458/head
jmontoyaa 8 years ago
parent c6ebe5abdb
commit 8ee48cc683
  1. 42
      plugin/ims_lti/ImsLtiPlugin.php

@ -108,28 +108,30 @@ class ImsLtiPlugin extends Plugin
$connection = $entityManager->getConnection();
$pluginSchema = new Schema();
$platform = $connection->getDatabasePlatform();
$toolTable = $pluginSchema->createTable(self::TABLE_TOOL);
$toolTable->addColumn(
'id',
\Doctrine\DBAL\Types\Type::INTEGER,
['autoincrement' => true, 'unsigned' => true]
);
$toolTable->addColumn('name', Type::STRING);
$toolTable->addColumn('description', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('launch_url', Type::TEXT);
$toolTable->addColumn('consumer_key', Type::STRING);
$toolTable->addColumn('shared_secret', Type::STRING);
$toolTable->addColumn('custom_params', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('is_global', Type::BOOLEAN);
$toolTable->setPrimaryKey(['id']);
$queries = $pluginSchema->toSql($platform);
foreach ($queries as $query) {
Database::query($query);
if (!$connection->getSchemaManager()->tablesExist(self::TABLE_TOOL)) {
$toolTable = $pluginSchema->createTable(self::TABLE_TOOL);
$toolTable->addColumn(
'id',
\Doctrine\DBAL\Types\Type::INTEGER,
['autoincrement' => true, 'unsigned' => true]
);
$toolTable->addColumn('name', Type::STRING);
$toolTable->addColumn('description', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('launch_url', Type::TEXT);
$toolTable->addColumn('consumer_key', Type::STRING);
$toolTable->addColumn('shared_secret', Type::STRING);
$toolTable->addColumn('custom_params', Type::TEXT)->setNotnull(false);
$toolTable->addColumn('is_global', Type::BOOLEAN);
$toolTable->setPrimaryKey(['id']);
$queries = $pluginSchema->toSql($platform);
foreach ($queries as $query) {
Database::query($query);
}
}
return true;
}

Loading…
Cancel
Save