addSql('CREATE INDEX IF NOT EXISTS IDX_EVENT_KIND ON event (kind)'); // Add composite index on event.kind and created_at for sorted magazine queries $this->addSql('CREATE INDEX IF NOT EXISTS IDX_EVENT_KIND_CREATED ON event (kind, created_at DESC)'); // Add index on article.slug for efficient article lookups $this->addSql('CREATE INDEX IF NOT EXISTS IDX_ARTICLE_SLUG ON article (slug)'); // Add index on event.pubkey for author-based queries $this->addSql('CREATE INDEX IF NOT EXISTS IDX_EVENT_PUBKEY ON event (pubkey)'); // Add GIN index on tags JSON column for efficient JSON queries // Note: jsonb_ops is the default operator class for JSONB columns $this->addSql('CREATE INDEX IF NOT EXISTS IDX_EVENT_TAGS_GIN ON event USING GIN (tags jsonb_ops)'); } public function down(Schema $schema): void { $this->addSql('DROP INDEX IF EXISTS IDX_EVENT_KIND'); $this->addSql('DROP INDEX IF EXISTS IDX_EVENT_KIND_CREATED'); $this->addSql('DROP INDEX IF EXISTS IDX_ARTICLE_SLUG'); $this->addSql('DROP INDEX IF EXISTS IDX_EVENT_PUBKEY'); $this->addSql('DROP INDEX IF EXISTS IDX_EVENT_TAGS_GIN'); } }