|
|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|