forked from ems-project/elasticms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: solve perf issue in log's query (upgrade scripts+debug)
- Loading branch information
Showing
5 changed files
with
141 additions
and
1 deletion.
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
35 changes: 35 additions & 0 deletions
35
EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_mysql/Version20241031110947.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migrations; | ||
|
||
use Doctrine\DBAL\Platforms\MySQLPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241031110947 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add a non-unique channel/ouuid index in logs table'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'." | ||
); | ||
$this->addSql('CREATE INDEX channel_ouuid_idx ON log_message (channel, ouuid)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'." | ||
); | ||
$this->addSql('DROP INDEX channel_ouuid_idx'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
EMS/core-bundle/src/Resources/DoctrineMigrations/pdo_pgsql/Version20241031110947.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migrations; | ||
|
||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241031110947 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add a non-unique channel/ouuid index in logs table'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'." | ||
); | ||
$this->addSql('CREATE INDEX channel_ouuid_idx ON log_message (channel, ouuid)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'." | ||
); | ||
$this->addSql('DROP INDEX channel_ouuid_idx'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
elasticms-web/migrations/pdo_mysql/Version20241031110947.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migrations; | ||
|
||
use Doctrine\DBAL\Platforms\MySQLPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241031110947 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add a non-unique channel/ouuid index in logs table'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'." | ||
); | ||
$this->addSql('CREATE INDEX channel_ouuid_idx ON log_message (channel, ouuid)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\MySQLPlatform'." | ||
); | ||
$this->addSql('DROP INDEX channel_ouuid_idx'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
elasticms-web/migrations/pdo_pgsql/Version20241031110947.php
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,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migrations; | ||
|
||
use Doctrine\DBAL\Platforms\PostgreSQLPlatform; | ||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20241031110947 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add a non-unique channel/ouuid index in logs table'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'." | ||
); | ||
$this->addSql('CREATE INDEX channel_ouuid_idx ON log_message (channel, ouuid)'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->abortIf( | ||
!$this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform, | ||
"Migration can only be executed safely on '\Doctrine\DBAL\Platforms\PostgreSQLPlatform'." | ||
); | ||
$this->addSql('DROP INDEX channel_ouuid_idx'); | ||
} | ||
} |