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 Version20250630093000 extends AbstractMigrationChamilo |
13
|
|
|
{ |
14
|
|
|
public function getDescription(): string |
15
|
|
|
{ |
16
|
|
|
return 'Create push_subscription table for browser push notifications.'; |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
public function up(Schema $schema): void |
20
|
|
|
{ |
21
|
|
|
$this->addSql( |
22
|
|
|
"CREATE TABLE push_subscription ( |
23
|
|
|
id INT AUTO_INCREMENT NOT NULL, |
24
|
|
|
user_id INT DEFAULT NULL, |
25
|
|
|
endpoint LONGTEXT NOT NULL, |
26
|
|
|
public_key LONGTEXT NOT NULL, |
27
|
|
|
auth_token LONGTEXT NOT NULL, |
28
|
|
|
content_encoding VARCHAR(20) DEFAULT 'aesgcm', |
29
|
|
|
user_agent LONGTEXT DEFAULT NULL, |
30
|
|
|
created_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', |
31
|
|
|
updated_at DATETIME NOT NULL COMMENT '(DC2Type:datetime)', |
32
|
|
|
INDEX idx_push_subscription_user (user_id), |
33
|
|
|
PRIMARY KEY(id) |
34
|
|
|
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC;" |
35
|
|
|
); |
36
|
|
|
|
37
|
|
|
$this->addSql( |
38
|
|
|
"ALTER TABLE push_subscription |
39
|
|
|
ADD CONSTRAINT FK_562830F3A76ED395 |
40
|
|
|
FOREIGN KEY (user_id) |
41
|
|
|
REFERENCES user (id) |
42
|
|
|
ON DELETE CASCADE;" |
43
|
|
|
); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function down(Schema $schema): void |
47
|
|
|
{ |
48
|
|
|
$this->addSql("DROP TABLE push_subscription;"); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|