1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
10
|
|
|
use Doctrine\DBAL\Schema\Schema; |
11
|
|
|
|
12
|
|
|
class Version20220614165020 extends AbstractMigrationChamilo |
13
|
|
|
{ |
14
|
|
|
public function getDescription(): string |
15
|
|
|
{ |
16
|
|
|
return 'Migrate track_e_access, track_e_lastaccess, track_e_uploads, track_e_downloads, track_e_links'; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function up(Schema $schema): void |
20
|
|
|
{ |
21
|
|
|
$this->addSql('DROP INDEX access_session_id ON track_e_access'); |
22
|
|
|
$this->addSql('DROP INDEX user_course_session_date ON track_e_access'); |
23
|
|
|
$this->addSql('ALTER TABLE track_e_access CHANGE access_session_id session_id INT NOT NULL'); |
24
|
|
|
$this->addSql('CREATE INDEX session_id ON track_e_access (session_id)'); |
25
|
|
|
$this->addSql('CREATE INDEX user_course_session_date ON track_e_access (access_user_id, c_id, session_id, access_date)'); |
26
|
|
|
|
27
|
|
|
$this->addSql('DROP INDEX access_session_id ON track_e_lastaccess'); |
28
|
|
|
$this->addSql('ALTER TABLE track_e_lastaccess CHANGE access_session_id session_id INT DEFAULT NULL'); |
29
|
|
|
$this->addSql('CREATE INDEX session_id ON track_e_lastaccess (session_id)'); |
30
|
|
|
|
31
|
|
|
$this->addSql('DROP INDEX upload_session_id ON track_e_uploads'); |
32
|
|
|
$this->addSql('ALTER TABLE track_e_uploads CHANGE upload_session_id session_id INT NOT NULL'); |
33
|
|
|
$this->addSql('CREATE INDEX session_id ON track_e_uploads (session_id)'); |
34
|
|
|
|
35
|
|
|
$this->addSql('DROP INDEX down_session_id ON track_e_downloads'); |
36
|
|
|
$this->addSql('ALTER TABLE track_e_downloads CHANGE down_session_id session_id INT NOT NULL'); |
37
|
|
|
$this->addSql('CREATE INDEX session_id ON track_e_downloads (session_id)'); |
38
|
|
|
|
39
|
|
|
$this->addSql('DROP INDEX links_session_id ON track_e_links'); |
40
|
|
|
$this->addSql('ALTER TABLE track_e_links CHANGE links_session_id session_id INT NOT NULL'); |
41
|
|
|
$this->addSql('CREATE INDEX session_id ON track_e_links (session_id)'); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
public function down(Schema $schema): void |
45
|
|
|
{ |
46
|
|
|
} |
47
|
|
|
} |
48
|
|
|
|