-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update date is equal to creation date #9021
When creating something the update date is also set, instead of being left to `null`. This matches what is typically done on filesystem. And most importantly it allow for huge optimization when sorting things by their latest update, since we do not need to compute "either creation date or update date". That allows MariaDB DB to optimize the query, and even more so if we add an index on that single column.
- Loading branch information
Showing
14 changed files
with
71 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
server/Application/Api/Input/Sorting/LatestModification.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migration; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
class Version20221010154735 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
// Delete all triggers, because they are a huge slow-down when updating each records. They will be recreated after migration | ||
$triggers = $this->connection->executeQuery('SHOW TRIGGERS;')->fetchFirstColumn(); | ||
foreach ($triggers as $trigger) { | ||
$this->addSql("DROP TRIGGER `$trigger`"); | ||
} | ||
|
||
$this->addSql('UPDATE `accounting_document` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `configuration` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `bookable_tag` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `transaction_line` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `user_tag` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `transaction` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `booking` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `bookable_metadata` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `country` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `license` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `log` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `bookable` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `transaction_tag` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `account` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `expense_claim` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `user` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `image` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
$this->addSql('UPDATE `message` SET updater_id = creator_id, update_date = creation_date WHERE updater_id IS NULL AND update_date IS NULL;'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
tests/ApplicationTest/Api/Input/Sorting/LatestModificationTest.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters