Merge pull request #214 from nextcloud/faster-update

Disable big int update
This commit is contained in:
Lukas Reschke 2017-10-19 11:30:03 +02:00 коммит произвёл GitHub
Родитель 4fa6669537 3b3e81b9cf
Коммит 3667bf016a
3 изменённых файлов: 33 добавлений и 7 удалений

Просмотреть файл

@ -24,6 +24,7 @@
namespace OCA\Activity\Migration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Type;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
@ -42,10 +43,10 @@ class Version2006Date20170808154933 extends SimpleMigrationStep {
if (!$schema->hasTable('activity')) {
$table = $schema->createTable('activity');
$table->addColumn('activity_id', 'integer', [
$table->addColumn('activity_id', Type::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
'length' => 20,
]);
$table->addColumn('timestamp', 'integer', [
'notnull' => true,
@ -99,25 +100,26 @@ class Version2006Date20170808154933 extends SimpleMigrationStep {
'notnull' => false,
'length' => 255,
]);
$table->addColumn('object_id', 'integer', [
$table->addColumn('object_id', Type::BIGINT, [
'notnull' => true,
'length' => 4,
'length' => 20,
'default' => 0,
]);
$table->setPrimaryKey(['activity_id']);
$table->addIndex(['timestamp'], 'activity_time');
$table->addIndex(['affecteduser', 'timestamp'], 'activity_user_time');
$table->addIndex(['affecteduser', 'user', 'timestamp'], 'activity_filter_by');
$table->addIndex(['affecteduser', 'app', 'timestamp'], 'activity_filter_app');
// FIXME Fixed install, see Version2006Date20170808155040: $table->addIndex(['affecteduser', 'app', 'timestamp'], 'activity_filter_app');
$table->addIndex(['affecteduser', 'type', 'app', 'timestamp'], 'activity_filter');
$table->addIndex(['object_type', 'object_id'], 'activity_object');
}
if (!$schema->hasTable('activity_mq')) {
$table = $schema->createTable('activity_mq');
$table->addColumn('mail_id', 'integer', [
$table->addColumn('mail_id', Type::BIGINT, [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
'length' => 20,
]);
$table->addColumn('amq_timestamp', 'integer', [
'notnull' => true,

Просмотреть файл

@ -39,6 +39,10 @@ class Version2006Date20170808155040 extends SimpleMigrationStep {
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/** @var Schema $schema */
/**
* FIXME To prevent slowness on update we don't change the index.
* FIXME Anyone complaining can manually update it.
$schema = $schemaClosure();
$table = $schema->getTable('activity');
@ -46,6 +50,8 @@ class Version2006Date20170808155040 extends SimpleMigrationStep {
$table->addIndex(['affecteduser', 'type', 'app', 'timestamp'], 'activity_filter');
return $schema;
*/
return null;
}
}

Просмотреть файл

@ -23,7 +23,9 @@
namespace OCA\Activity\Migration;
use Doctrine\DBAL\Schema\Schema;
use OCP\Migration\BigIntMigration;
use OCP\Migration\IOutput;
class Version2006Date20170919095939 extends BigIntMigration {
@ -40,4 +42,20 @@ class Version2006Date20170919095939 extends BigIntMigration {
];
}
/**
* @param IOutput $output
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
* @param array $options
* @return null|Schema
* @since 13.0.0
*/
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
/**
* FIXME To prevent slowness on update we don't change the schema.
* FIXME Instead it can be updated with ./occ db:convert-filecache-bigint
parent::changeSchema($output, $schemaClosure, $options);
*/
return null;
}
}