0 ? reset($params) : 'default'; /** @var \common_persistence_Persistence $persistence */ $persistence = $this->getServiceLocator()->get(\common_persistence_Manager::SERVICE_KEY)->getPersistenceById($persistenceId); /** @var \common_persistence_sql_dbal_SchemaManager $schemaManager */ $schemaManager = $persistence->getDriver()->getSchemaManager(); $schema = $schemaManager->createSchema(); $fromSchema = clone $schema; if ($schema->hasTable(RdsToolsStateStorage::TABLE_NAME)) { return new Report(Report::TYPE_INFO, 'Tool states service registered'); } $revisionTable = $schema->createTable(RdsToolsStateStorage::TABLE_NAME); $revisionTable->addOption('engine', 'MyISAM'); $revisionTable->addColumn(RdsToolsStateStorage::COLUMN_DELIVERY_EXECUTION_ID, 'string', ['notnull' => true, 'length' => 255]); $revisionTable->addColumn(RdsToolsStateStorage::COLUMN_TOOL_NAME, 'string', ['notnull' => true, 'length' => 60]); $longtextThreshold = 16777215 + 1; $revisionTable->addColumn(RdsToolsStateStorage::COLUMN_TOOL_STATE, 'string', ['notnull' => false, 'length' => $longtextThreshold]); $revisionTable->addUniqueIndex( [RdsToolsStateStorage::COLUMN_DELIVERY_EXECUTION_ID, RdsToolsStateStorage::COLUMN_TOOL_NAME], 'IDX_' . RdsToolsStateStorage::TABLE_NAME . '_' . 'execution_and_tool_name' ); $queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema); foreach ($queries as $query) { $persistence->exec($query); } return new Report(Report::TYPE_SUCCESS, 'RDS schema for RdsToolsStateStorage is now installed'); } }