From 88ab243b9a2404a2b50f61fe396ca4507bac84b6 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 19 Sep 2019 15:41:41 +0200 Subject: [PATCH] Add sql index --- src/CoreBundle/Entity/TrackELogin.php | 3 ++- src/CoreBundle/Migrations/Schema/V200/Version20.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CoreBundle/Entity/TrackELogin.php b/src/CoreBundle/Entity/TrackELogin.php index fd57268960..5acac88a55 100644 --- a/src/CoreBundle/Entity/TrackELogin.php +++ b/src/CoreBundle/Entity/TrackELogin.php @@ -9,7 +9,8 @@ use Doctrine\ORM\Mapping as ORM; * TrackELogin. * * @ORM\Table(name="track_e_login", indexes={ - * @ORM\Index(name="login_user_id", columns={"login_user_id"}) + * @ORM\Index(name="login_user_id", columns={"login_user_id"}), + * @ORM\Index(name="idx_track_e_login_date", columns={"login_date"}) * }) * @ORM\Entity */ diff --git a/src/CoreBundle/Migrations/Schema/V200/Version20.php b/src/CoreBundle/Migrations/Schema/V200/Version20.php index e6238e97e4..4b7f3739e4 100644 --- a/src/CoreBundle/Migrations/Schema/V200/Version20.php +++ b/src/CoreBundle/Migrations/Schema/V200/Version20.php @@ -808,6 +808,11 @@ class Version20 extends AbstractMigrationChamilo $this->addSql('CREATE INDEX idx_track_e_attempt_tms ON track_e_attempt (tms)'); } + $table = $schema->getTable('track_e_login'); + if (!$table->hasIndex('idx_track_e_login_date')) { + $this->addSql('CREATE INDEX idx_track_e_login_date ON track_e_login (login_date)'); + } + $this->addSql('ALTER TABLE c_group_info ADD CONSTRAINT FK_CE06532491D79BD3 FOREIGN KEY (c_id) REFERENCES course (id);'); $this->addSql('ALTER TABLE course_category CHANGE auth_course_child auth_course_child VARCHAR(40) DEFAULT NULL');