diff --git a/src/CoreBundle/Entity/ResourceLink.php b/src/CoreBundle/Entity/ResourceLink.php index 9ea157235a..2c621fb849 100644 --- a/src/CoreBundle/Entity/ResourceLink.php +++ b/src/CoreBundle/Entity/ResourceLink.php @@ -22,6 +22,10 @@ use Symfony\Component\Serializer\Annotation\Groups; #[ApiResource] #[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)] #[Gedmo\SoftDeleteable(fieldName: 'deletedAt', timeAware: false, hardDelete: true)] class ResourceLink implements Stringable diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php b/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php index 1f72f9371d..4d952c7c47 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20170525122900.php @@ -38,7 +38,7 @@ class Version20170525122900 extends AbstractMigrationChamilo if (!$schema->hasTable('resource_link')) { $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;" ); }