From 227c12b962328bfe4ad1f5be7705c2e06522aaa8 Mon Sep 17 00:00:00 2001 From: christianbeeznst Date: Thu, 18 Jul 2024 11:15:06 -0500 Subject: [PATCH] Internal: Add sticky index to course table --- src/CoreBundle/Entity/Course.php | 1 + .../Migrations/Schema/V200/Version20191101132000.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/CoreBundle/Entity/Course.php b/src/CoreBundle/Entity/Course.php index bfccb9c2f8..07d08fe833 100644 --- a/src/CoreBundle/Entity/Course.php +++ b/src/CoreBundle/Entity/Course.php @@ -50,6 +50,7 @@ use Symfony\Component\Validator\Constraints as Assert; security: "is_granted('ROLE_USER')" )] #[ORM\Table(name: 'course')] +#[ORM\Index(columns: ['sticky'], name: 'idx_course_sticky')] #[UniqueEntity('code')] #[UniqueEntity('visualCode')] #[ORM\Entity(repositoryClass: CourseRepository::class)] diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php b/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php index 142b26b505..eae52083fc 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20191101132000.php @@ -36,6 +36,10 @@ class Version20191101132000 extends AbstractMigrationChamilo $this->addSql('ALTER TABLE course ADD sticky TINYINT(1) NOT NULL'); } + if (!$table->hasIndex('idx_course_sticky')) { + $this->addSql('CREATE INDEX idx_course_sticky ON course (sticky)'); + } + if (!$table->hasColumn('resource_node_id')) { $this->addSql('ALTER TABLE course ADD COLUMN resource_node_id INT DEFAULT NULL;'); $this->addSql(