performance improvements (#927)
This commit is contained in:
53
src/Migrations/Version20190706224211.php
Normal file
53
src/Migrations/Version20190706224211.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use App\Doctrine\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Fix meta-table definitions
|
||||
*
|
||||
* @version 1.1
|
||||
*/
|
||||
final class Version20190706224211 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Fix meta-table definitions';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$timesheetMeta = $schema->getTable('kimai2_timesheet_meta');
|
||||
$timesheetMeta->changeColumn('visible', ['notnull' => true, 'default' => false]);
|
||||
$timesheetMeta->changeColumn('timesheet_id', ['notnull' => true]);
|
||||
|
||||
$projectMeta = $schema->getTable('kimai2_projects_meta');
|
||||
$projectMeta->changeColumn('visible', ['notnull' => true, 'default' => false]);
|
||||
$projectMeta->changeColumn('project_id', ['notnull' => true]);
|
||||
|
||||
$customerMeta = $schema->getTable('kimai2_customers_meta');
|
||||
$customerMeta->changeColumn('visible', ['notnull' => true, 'default' => false]);
|
||||
$customerMeta->changeColumn('customer_id', ['notnull' => true]);
|
||||
|
||||
$activityMeta = $schema->getTable('kimai2_activities_meta');
|
||||
$activityMeta->changeColumn('visible', ['notnull' => true, 'default' => false]);
|
||||
$activityMeta->changeColumn('activity_id', ['notnull' => true]);
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
// the columns above were created incorrect in migration Version20190617100845 for upgraded systems
|
||||
// that's why there are no equivalent changes in down()
|
||||
}
|
||||
}
|
||||
70
src/Migrations/Version20190706224219.php
Normal file
70
src/Migrations/Version20190706224219.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace DoctrineMigrations;
|
||||
|
||||
use App\Doctrine\AbstractMigration;
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
|
||||
/**
|
||||
* Creates several indices to improve speed for default queries.
|
||||
*
|
||||
* @version 1.1
|
||||
*/
|
||||
final class Version20190706224219 extends AbstractMigration
|
||||
{
|
||||
public function getDescription(): string
|
||||
{
|
||||
return 'Creates several indices to improve speed for default queries.';
|
||||
}
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
$timesheet = $schema->getTable('kimai2_timesheet');
|
||||
$timesheet->addIndex(['user', 'start_time'], 'IDX_4F60C6B18D93D649502DF587');
|
||||
$timesheet->addIndex(['start_time'], 'IDX_4F60C6B1502DF587');
|
||||
$timesheet->addIndex(['start_time', 'end_time'], 'IDX_4F60C6B1502DF58741561401');
|
||||
$timesheet->addIndex(['start_time', 'end_time', 'user'], 'IDX_4F60C6B1502DF587415614018D93D649');
|
||||
|
||||
$activity = $schema->getTable('kimai2_activities');
|
||||
$activity->addIndex(['visible', 'project_id'], 'IDX_8811FE1C7AB0E859166D1F9C');
|
||||
$activity->addIndex(['visible', 'project_id', 'name'], 'IDX_8811FE1C7AB0E859166D1F9C5E237E06');
|
||||
$activity->addIndex(['visible', 'name'], 'IDX_8811FE1C7AB0E8595E237E06');
|
||||
|
||||
$project = $schema->getTable('kimai2_projects');
|
||||
$project->addIndex(['customer_id', 'visible', 'name'], 'IDX_407F12069395C3F37AB0E8595E237E06');
|
||||
$project->addIndex(['customer_id', 'visible', 'id'], 'IDX_407F12069395C3F37AB0E859BF396750');
|
||||
|
||||
$customer = $schema->getTable('kimai2_customers');
|
||||
$customer->addIndex(['visible'], 'IDX_5A9760447AB0E859');
|
||||
}
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
$activity = $schema->getTable('kimai2_activities');
|
||||
$activity->dropIndex('IDX_8811FE1C7AB0E859166D1F9C');
|
||||
$activity->dropIndex('IDX_8811FE1C7AB0E859166D1F9C5E237E06');
|
||||
$activity->dropIndex('IDX_8811FE1C7AB0E8595E237E06');
|
||||
|
||||
$customer = $schema->getTable('kimai2_customers');
|
||||
$customer->dropIndex('IDX_5A9760447AB0E859');
|
||||
|
||||
$project = $schema->getTable('kimai2_projects');
|
||||
$project->dropIndex('IDX_407F12069395C3F37AB0E8595E237E06');
|
||||
$project->dropIndex('IDX_407F12069395C3F37AB0E859BF396750');
|
||||
|
||||
$timesheet = $schema->getTable('kimai2_timesheet');
|
||||
$timesheet->dropIndex('IDX_4F60C6B18D93D649502DF587');
|
||||
$timesheet->dropIndex('IDX_4F60C6B1502DF587');
|
||||
$timesheet->dropIndex('IDX_4F60C6B1502DF587415614018D93D649');
|
||||
$timesheet->dropIndex('idx_4f60c6b1502df58741561401');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user