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
|
|
|
final class Version20250604143900 extends AbstractMigrationChamilo |
13
|
|
|
{ |
14
|
|
|
public function getDescription(): string |
15
|
|
|
{ |
16
|
|
|
return 'Create third_party, third_party_data_exchange and third_party_data_exchange_user tables for GDPR compliance.'; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function up(Schema $schema): void |
20
|
|
|
{ |
21
|
|
|
$this->addSql(" |
22
|
|
|
CREATE TABLE third_party ( |
23
|
|
|
id INT AUTO_INCREMENT NOT NULL, |
24
|
|
|
name TEXT NOT NULL, |
25
|
|
|
description TEXT DEFAULT NULL, |
26
|
|
|
address TEXT DEFAULT NULL, |
27
|
|
|
website TEXT DEFAULT NULL, |
28
|
|
|
data_exchange_party TINYINT(1) NOT NULL, |
29
|
|
|
recruiter TINYINT(1) NOT NULL, |
30
|
|
|
PRIMARY KEY(id) |
31
|
|
|
); |
32
|
|
|
"); |
33
|
|
|
|
34
|
|
|
$this->addSql(" |
35
|
|
|
CREATE TABLE third_party_data_exchange ( |
36
|
|
|
id INT AUTO_INCREMENT NOT NULL, |
37
|
|
|
third_party_id INT NOT NULL, |
38
|
|
|
sent_at DATETIME NOT NULL, |
39
|
|
|
description TEXT DEFAULT NULL, |
40
|
|
|
all_users TINYINT(1) NOT NULL, |
41
|
|
|
PRIMARY KEY(id), |
42
|
|
|
CONSTRAINT FK_TPDE_TP FOREIGN KEY (third_party_id) REFERENCES third_party(id) ON DELETE CASCADE |
43
|
|
|
); |
44
|
|
|
"); |
45
|
|
|
|
46
|
|
|
$this->addSql(" |
47
|
|
|
CREATE TABLE third_party_data_exchange_user ( |
48
|
|
|
id INT AUTO_INCREMENT NOT NULL, |
49
|
|
|
third_party_data_exchange_id INT NOT NULL, |
50
|
|
|
user_id INT NOT NULL, |
51
|
|
|
PRIMARY KEY(id), |
52
|
|
|
CONSTRAINT FK_TPDEU_TPDE FOREIGN KEY (third_party_data_exchange_id) REFERENCES third_party_data_exchange(id) ON DELETE CASCADE, |
53
|
|
|
CONSTRAINT FK_TPDEU_USER FOREIGN KEY (user_id) REFERENCES user(id) ON DELETE CASCADE |
54
|
|
|
); |
55
|
|
|
"); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
public function down(Schema $schema): void |
59
|
|
|
{ |
60
|
|
|
$this->addSql('DROP TABLE third_party_data_exchange_user;'); |
61
|
|
|
$this->addSql('DROP TABLE third_party_data_exchange;'); |
62
|
|
|
$this->addSql('DROP TABLE third_party;'); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|