1
|
|
|
<?php |
2
|
|
|
/* For licensing terms, see /license.txt */ |
3
|
|
|
|
4
|
|
|
declare(strict_types=1); |
5
|
|
|
|
6
|
|
|
namespace Chamilo\CoreBundle\Migrations\Schema\V200; |
7
|
|
|
|
8
|
|
|
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo; |
9
|
|
|
use Doctrine\DBAL\Schema\Schema; |
10
|
|
|
|
11
|
|
|
class Version20240321142500 extends AbstractMigrationChamilo |
12
|
|
|
{ |
13
|
|
|
public function getDescription(): string |
14
|
|
|
{ |
15
|
|
|
return 'Remove personal agenda related tables'; |
16
|
|
|
} |
17
|
|
|
|
18
|
|
|
public function up(Schema $schema): void |
19
|
|
|
{ |
20
|
|
|
$this->addSql('DROP TABLE IF EXISTS personal_agenda'); |
21
|
|
|
$this->addSql('DROP TABLE IF EXISTS personal_agenda_repeat'); |
22
|
|
|
$this->addSql('DROP TABLE IF EXISTS personal_agenda_repeat_not'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function down(Schema $schema): void |
26
|
|
|
{ |
27
|
|
|
if (!$schema->hasTable('personal_agenda')) { |
28
|
|
|
$this->addSql('CREATE TABLE personal_agenda (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, title TEXT DEFAULT NULL, text TEXT DEFAULT NULL, date DATETIME DEFAULT NULL, enddate DATETIME DEFAULT NULL, parent_event_id INT DEFAULT NULL, all_day INT NOT NULL, color VARCHAR(20) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
if (!$schema->hasTable('personal_agenda_repeat')) { |
32
|
|
|
$this->addSql('CREATE TABLE personal_agenda_repeat (cal_id INT AUTO_INCREMENT NOT NULL, cal_type VARCHAR(20) DEFAULT NULL, cal_end INT DEFAULT NULL, cal_frequency INT DEFAULT NULL, cal_days VARCHAR(7) DEFAULT NULL, PRIMARY KEY(cal_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
if (!$schema->hasTable('personal_agenda_repeat_not')) { |
36
|
|
|
$this->addSql('CREATE TABLE personal_agenda_repeat_not (cal_id INT NOT NULL, cal_date INT NOT NULL, PRIMARY KEY(cal_id, cal_date)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); |
37
|
|
|
} |
38
|
|
|
} |
39
|
|
|
} |
40
|
|
|
|