Database indexes, fix manifest

This commit is contained in:
Ernest Wiśniewski 2023-06-15 11:14:58 +02:00
parent 07f6976d41
commit 1f8c4d65ab
8 changed files with 132 additions and 163 deletions

View file

@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230615085154 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX entry_title_ts_idx');
$this->addSql('DROP INDEX entry_body_ts_idx');
$this->addSql('ALTER TABLE entry DROP title_ts');
$this->addSql('ALTER TABLE entry DROP body_ts');
$this->addSql('CREATE INDEX entry_score_idx ON entry (score)');
$this->addSql('CREATE INDEX entry_comment_count_idx ON entry (comment_count)');
$this->addSql('DROP INDEX entry_comment_body_ts_idx');
$this->addSql('ALTER TABLE entry_comment DROP body_ts');
$this->addSql('DROP INDEX post_body_ts_idx');
$this->addSql('ALTER TABLE post DROP body_ts');
$this->addSql('CREATE INDEX post_score_idx ON post (score)');
$this->addSql('CREATE INDEX post_comment_count_idx ON post (comment_count)');
$this->addSql('DROP INDEX post_comment_body_ts_idx');
$this->addSql('ALTER TABLE post_comment DROP body_ts');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP INDEX entry_score_idx');
$this->addSql('DROP INDEX entry_comment_count_idx');
$this->addSql('ALTER TABLE entry ADD title_ts TEXT DEFAULT \'english\'');
$this->addSql('ALTER TABLE entry ADD body_ts TEXT DEFAULT \'english\'');
$this->addSql('CREATE INDEX entry_title_ts_idx ON entry (title_ts)');
$this->addSql('CREATE INDEX entry_body_ts_idx ON entry (body_ts)');
$this->addSql('DROP INDEX post_score_idx');
$this->addSql('DROP INDEX post_comment_count_idx');
$this->addSql('ALTER TABLE post ADD body_ts TEXT DEFAULT \'english\'');
$this->addSql('CREATE INDEX post_body_ts_idx ON post (body_ts)');
$this->addSql('ALTER TABLE post_comment ADD body_ts TEXT DEFAULT \'english\'');
$this->addSql('CREATE INDEX post_comment_body_ts_idx ON post_comment (body_ts)');
$this->addSql('ALTER TABLE entry_comment ADD body_ts TEXT DEFAULT \'english\'');
$this->addSql('CREATE INDEX entry_comment_body_ts_idx ON entry_comment (body_ts)');
}
}

View file

@ -0,0 +1,46 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230615091124 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE INDEX entry_last_active_at_idx ON entry (last_active)');
$this->addSql('CREATE INDEX entry_comment_up_votes_idx ON entry_comment (up_votes)');
$this->addSql('CREATE INDEX entry_comment_last_active_at_idx ON entry_comment (last_active)');
$this->addSql('CREATE INDEX entry_comment_created_at_idx ON entry_comment (created_at)');
$this->addSql('CREATE INDEX post_last_active_at_idx ON post (last_active)');
$this->addSql('CREATE INDEX post_comment_up_votes_idx ON post_comment (up_votes)');
$this->addSql('CREATE INDEX post_comment_last_active_at_idx ON post_comment (last_active)');
$this->addSql('CREATE INDEX post_comment_created_at_idx ON post_comment (created_at)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP INDEX post_last_active_at_idx');
$this->addSql('DROP INDEX entry_last_active_at_idx');
$this->addSql('DROP INDEX post_comment_up_votes_idx');
$this->addSql('DROP INDEX post_comment_last_active_at_idx');
$this->addSql('DROP INDEX post_comment_created_at_idx');
$this->addSql('DROP INDEX entry_comment_up_votes_idx');
$this->addSql('DROP INDEX entry_comment_last_active_at_idx');
$this->addSql('DROP INDEX entry_comment_created_at_idx');
}
}

View file

@ -14,37 +14,42 @@
],
"icons": [
{
"src": "assets/icons/512x512.png",
"src": "assets/icons/icon-1024x1024.png",
"sizes": "1024x1024",
"type": "image/png"
},
{
"src": "assets/icons/icon-512x512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "assets/icons/384x384.png",
"sizes": "384x384",
"src": "assets/icons/icon-256x256.png",
"sizes": "256x256",
"type": "image/png"
},
{
"src": "assets/icons/192x192.png",
"src": "assets/icons/icon-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "assets/icons/128x128.png",
"sizes": "128x128",
"src": "assets/icons/icon-144x144.png",
"sizes": "144x44",
"type": "image/png"
},
{
"src": "assets/icons/96x96.png",
"src": "assets/icons/icon-96x96.png",
"sizes": "96x96",
"type": "image/png"
},
{
"src": "assets/icons/72x72.png",
"src": "assets/icons/icon-72x72.png",
"sizes": "72x72",
"type": "image/png"
},
{
"src": "assets/icons/48x48.png",
"src": "assets/icons/icon-48x48.png",
"sizes": "48x48",
"type": "image/png"
}

View file

@ -1,154 +0,0 @@
{
"id": "/",
"scope": "/",
"start_url": "/",
"name": "/kbin",
"short_name": "/kbin",
"description": "/kbin Progressive Web App",
"display": "standalone",
"orientation": "portrait",
"background_color":"#1E1F22",
"theme_color":"#1E1F22",
"related_applications": [],
"prefer_related_applications": false,
"display_override": [
"window-controls-overlay"
],
"icons":[
{
"purpose":"any",
"src":"assets/icons/icon-48x48.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"48x48",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-48x48.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"48x48",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-72x72.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"72x72",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-72x72.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"72x72",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-96x96.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"96x96",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-96x96.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"96x96",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-144x144.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"144x144",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-144x144.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"144x144",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-192x192.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"192x192",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-192x192.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"192x192",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-256x256.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"256x256",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-256x256.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"256x256",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-384x384.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"384x384",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-384x384.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"384x384",
"type":"image/png"},
{
"purpose":"any",
"src":"assets/icons/icon-512x512.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"512x512",
"type":"image/png"},
{
"purpose":"maskable",
"src":"assets/icons/icon-512x512.png?v=a1b1aa69784e84b93da65e9757bc4658",
"sizes":"512x512",
"type":"image/png"
}
],
"screenshots": [
{
"src": "assets/screenshots/screen.png",
"sizes": "1600x869",
"type": "image/png"
}
],
"features": [
"fediverse",
"ActivityPub",
"simple"
],
"categories": [
"social",
"microblogging"
],
"shortcuts":[
{
"name":"Open Microblog",
"short_name":"Microblog",
"description":"Open the Microblog section",
"url":"/microblog",
"icons":[
{
"src":"assets/icons/kbin-shortcut-microblog.png",
"sizes":"96x96"
}
]
},
{
"name":"Open Magazines",
"short_name":"Magazines",
"description":"Open the Magazines list",
"url":"/magazines",
"icons":[
{
"src":"assets/icons/kbin-shortcut-magazines.png",
"sizes":"96x96"
}
]
},
{
"name":"Open People",
"short_name":"People",
"description":"Open the People list",
"url":"/people",
"icons":[
{
"src":"assets/icons/kbin-shortcut-people.png",
"sizes":"96x96"
}
]
}
]
}

View file

@ -41,7 +41,10 @@ use Webmozart\Assert\Assert;
#[Index(columns: ['visibility'], name: 'entry_visibility_idx')]
#[Index(columns: ['is_adult'], name: 'entry_adult_idx')]
#[Index(columns: ['ranking'], name: 'entry_ranking_idx')]
#[Index(columns: ['score'], name: 'entry_score_idx')]
#[Index(columns: ['comment_count'], name: 'entry_comment_count_idx')]
#[Index(columns: ['created_at'], name: 'entry_created_at_idx')]
#[Index(columns: ['last_active'], name: 'entry_last_active_at_idx')]
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
class Entry implements VotableInterface, CommentInterface, DomainInterface, VisibilityInterface, RankingInterface, ReportInterface, FavouriteInterface, ViewCountable, TagInterface, ActivityPubActivityInterface
{

View file

@ -25,6 +25,7 @@ use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
@ -33,6 +34,9 @@ use Webmozart\Assert\Assert;
#[Entity(repositoryClass: EntryCommentRepository::class)]
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
#[Index(columns: ['up_votes'], name: 'entry_comment_up_votes_idx')]
#[Index(columns: ['last_active'], name: 'entry_comment_last_active_at_idx')]
#[Index(columns: ['created_at'], name: 'entry_comment_created_at_idx')]
class EntryComment implements VotableInterface, VisibilityInterface, ReportInterface, FavouriteInterface, TagInterface, ActivityPubActivityInterface
{
use VotableTrait;

View file

@ -38,7 +38,10 @@ use Webmozart\Assert\Assert;
#[Index(columns: ['visibility'], name: 'post_visibility_idx')]
#[Index(columns: ['is_adult'], name: 'post_adult_idx')]
#[Index(columns: ['ranking'], name: 'post_ranking_idx')]
#[Index(columns: ['score'], name: 'post_score_idx')]
#[Index(columns: ['comment_count'], name: 'post_comment_count_idx')]
#[Index(columns: ['created_at'], name: 'post_created_at_idx')]
#[Index(columns: ['last_active'], name: 'post_last_active_at_idx')]
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
class Post implements VotableInterface, CommentInterface, VisibilityInterface, RankingInterface, ReportInterface, FavouriteInterface, TagInterface, ActivityPubActivityInterface
{

View file

@ -25,6 +25,7 @@ use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\Index;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToOne;
use Doctrine\ORM\Mapping\OneToMany;
@ -33,6 +34,9 @@ use Webmozart\Assert\Assert;
#[Entity(repositoryClass: PostCommentRepository::class)]
#[Cache(usage: 'NONSTRICT_READ_WRITE')]
#[Index(columns: ['up_votes'], name: 'post_comment_up_votes_idx')]
#[Index(columns: ['last_active'], name: 'post_comment_last_active_at_idx')]
#[Index(columns: ['created_at'], name: 'post_comment_created_at_idx')]
class PostComment implements VotableInterface, VisibilityInterface, ReportInterface, FavouriteInterface, TagInterface, ActivityPubActivityInterface
{
use VotableTrait;