-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathVersion20250421163214.php
More file actions
41 lines (34 loc) · 1.27 KB
/
Version20250421163214.php
File metadata and controls
41 lines (34 loc) · 1.27 KB
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
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add birthday calendar.
*/
final class Version20250421163214 extends AbstractMigration
{
public function getDescription(): string
{
return 'Add birthday calendars';
}
public function up(Schema $schema): void
{
$engine = $this->connection->getDatabasePlatform()->getName();
if ('mysql' === $engine) {
$this->addSql('ALTER TABLE addressbooks ADD included_in_birthday_calendar TINYINT(1) DEFAULT 0');
} elseif ('postgresql' === $engine) {
$this->addSql('ALTER TABLE addressbooks ADD COLUMN included_in_birthday_calendar BOOLEAN DEFAULT FALSE;');
} elseif ('sqlite' === $engine) {
$this->addSql('ALTER TABLE addressbooks ADD COLUMN included_in_birthday_calendar INTEGER DEFAULT 0;');
}
}
public function down(Schema $schema): void
{
if ('mysql' === $this->connection->getDatabasePlatform()->getName()) {
$this->addSql('ALTER TABLE addressbooks DROP included_in_birthday_calendar');
} else {
$this->addSql('ALTER TABLE addressbooks DROP COLUMN included_in_birthday_calendar');
}
}
}