-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathVersion20231029164236.php
77 lines (66 loc) · 1.78 KB
/
Version20231029164236.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
declare(strict_types=1);
// phpcs:ignoreFile
namespace DoctrineMigrations;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Override;
/**
* Changed database structure
*/
final class Version20231029164236 extends AbstractMigration
{
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function getDescription(): string
{
return 'Change headers, parameters fields inside log_request table';
}
/**
* @noinspection PhpMissingParentCallCommonInspection
*/
#[Override]
public function isTransactional(): bool
{
return false;
}
/**
* {@inheritdoc}
*/
#[Override]
public function up(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
'Migration can only be executed safely on \'mysql\'.'
);
$sql = <<<SQL
ALTER TABLE log_request
CHANGE headers headers JSON NOT NULL COMMENT '(DC2Type:json)',
CHANGE parameters parameters JSON NOT NULL COMMENT '(DC2Type:json)'
SQL;
$this->addSql($sql);
}
/**
* @noinspection PhpMissingParentCallCommonInspection
*
* {@inheritdoc}
*/
#[Override]
public function down(Schema $schema): void
{
$this->abortIf(
!$this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform,
'Migration can only be executed safely on \'mysql\'.'
);
$sql = <<<SQL
ALTER TABLE log_request
CHANGE headers headers LONGTEXT NOT NULL COMMENT '(DC2Type:json)',
CHANGE parameters parameters LONGTEXT NOT NULL COMMENT '(DC2Type:json)'
SQL;
$this->addSql($sql);
}
}