-
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.
perf/save_ratings_count_in_notices_entities
- Loading branch information
1 parent
c252437
commit f1e3111
Showing
18 changed files
with
480 additions
and
182 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,14 @@ | ||
framework: | ||
messenger: | ||
# Uncomment this (and the failed transport below) to send failed messages to this transport for later handling. | ||
# failure_transport: failed | ||
|
||
transports: | ||
# https://symfony.com/doc/current/messenger.html#transport-configuration | ||
# async: '%env(MESSENGER_TRANSPORT_DSN)%' | ||
# failed: 'doctrine://default?queue_name=failed' | ||
# sync: 'sync://' | ||
|
||
routing: | ||
# Route your messages to the transports | ||
# 'App\Message\YourMessage': async |
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,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Application\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20210704210627 extends AbstractMigration | ||
{ | ||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE notice | ||
ADD COLUMN badged_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN displayed_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN unfolded_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN clicked_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN liked_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN disliked_count int DEFAULT 0 NOT NULL, | ||
ADD COLUMN dismissed_count int DEFAULT 0 NOT NULL; | ||
'); | ||
|
||
$this->addSql('CREATE INDEX rating_notice_type_index ON rating (notice_id, type);'); | ||
|
||
$this->addSql('UPDATE notice n | ||
SET n.badged_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'badge\'), | ||
n.displayed_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'display\'), | ||
n.unfolded_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'unfold\'), | ||
n.clicked_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'outbound-click\'), | ||
n.liked_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'like\') - (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'unlike\'), | ||
n.disliked_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'dislike\') - (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'undislike\'), | ||
n.dismissed_count = (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'dismiss\') - (SELECT COUNT(*) FROM rating r WHERE r.notice_id = n.id AND r.type = \'undismiss\'); | ||
'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE rating DROP INDEX rating_notice_type_index'); | ||
|
||
$this->addSql('ALTER TABLE notice | ||
DROP COLUMN badged_count, | ||
DROP COLUMN displayed_count, | ||
DROP COLUMN unfolded_count, | ||
DROP COLUMN clicked_count, | ||
DROP COLUMN liked_count, | ||
DROP COLUMN disliked_count, | ||
DROP COLUMN dismissed_count | ||
'); | ||
} | ||
} |
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,9 @@ | ||
POST http://localhost:8088/api/v3/notices/1028/ratings | ||
Content-Type: application/json | ||
|
||
{ | ||
"ratingType": "badge" | ||
} | ||
|
||
|
||
### |
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
Oops, something went wrong.