Internal: Add index to resource link with sortable groups - refs BT#22193

```sql
CREATE INDEX idx_resource_link_sortable_groups ON resource_link (c_id, session_id, usergroup_id, group_id, user_id, resource_type_group);
```
pull/5922/head
Angel Fernando Quiroz Campos 2 weeks ago
parent e375c5e57b
commit 27cc4ae121
No known key found for this signature in database
GPG Key ID: B284841AE3E562CD
  1. 4
      src/CoreBundle/Entity/ResourceLink.php
  2. 2
      src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php

@ -22,6 +22,10 @@ use Symfony\Component\Serializer\Annotation\Groups;
#[ApiResource] #[ApiResource]
#[ORM\Table(name: 'resource_link')] #[ORM\Table(name: 'resource_link')]
#[ORM\Index(
columns: ['c_id', 'session_id', 'usergroup_id', 'group_id', 'user_id', 'resource_type_group'],
name: 'idx_resource_link_sortable_groups'
)]
#[ORM\Entity(repositoryClass: ResourceLinkRepository::class)] #[ORM\Entity(repositoryClass: ResourceLinkRepository::class)]
#[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)] #[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)]
class ResourceLink implements Stringable class ResourceLink implements Stringable

@ -38,7 +38,7 @@ class Version20170525122900 extends AbstractMigrationChamilo
if (!$schema->hasTable('resource_link')) { if (!$schema->hasTable('resource_link')) {
$this->addSql( $this->addSql(
"CREATE TABLE resource_link (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, c_id INT DEFAULT NULL, session_id INT DEFAULT NULL, usergroup_id INT DEFAULT NULL, group_id INT DEFAULT NULL, user_id INT DEFAULT NULL, visibility INT NOT NULL, start_visibility_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', end_visibility_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', display_order INT NOT NULL, resource_type_group INT NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', deleted_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_398C394B1BAD783F (resource_node_id), INDEX IDX_398C394B91D79BD3 (c_id), INDEX IDX_398C394B613FECDF (session_id), INDEX IDX_398C394BD2112630 (usergroup_id), INDEX IDX_398C394BFE54D947 (group_id), INDEX IDX_398C394BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" "CREATE TABLE resource_link (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, c_id INT DEFAULT NULL, session_id INT DEFAULT NULL, usergroup_id INT DEFAULT NULL, group_id INT DEFAULT NULL, user_id INT DEFAULT NULL, visibility INT NOT NULL, start_visibility_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', end_visibility_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', display_order INT NOT NULL, resource_type_group INT NOT NULL, created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', deleted_at DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime)', INDEX IDX_398C394B1BAD783F (resource_node_id), INDEX IDX_398C394B91D79BD3 (c_id), INDEX IDX_398C394B613FECDF (session_id), INDEX IDX_398C394BD2112630 (usergroup_id), INDEX IDX_398C394BFE54D947 (group_id), INDEX IDX_398C394BA76ED395 (user_id), INDEX idx_resource_link_sortable_groups (c_id, session_id, usergroup_id, group_id, user_id, resource_type_group), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;"
); );
} }

Loading…
Cancel
Save