wallabag/migrations/Version20190808124957.php

50 lines
2.0 KiB
PHP
Raw Normal View History

2019-08-08 15:19:53 +02:00
<?php
namespace Application\Migrations;
2023-08-05 19:35:09 +02:00
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
2019-08-08 15:19:53 +02:00
use Doctrine\DBAL\Schema\Schema;
2024-02-19 01:30:12 +01:00
use Wallabag\Doctrine\WallabagMigration;
2019-08-08 15:19:53 +02:00
/**
* Change the internal setting table name.
*/
final class Version20190808124957 extends WallabagMigration
{
public function up(Schema $schema): void
{
2023-08-05 19:35:09 +02:00
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting', true) . ' RENAME TO ' . $this->getTable('internal_setting', true));
break;
2023-08-05 19:35:09 +02:00
case $platform instanceof MySQLPlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME ' . $this->getTable('internal_setting'));
break;
2023-08-05 19:35:09 +02:00
case $platform instanceof PostgreSQLPlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting'));
break;
}
}
public function down(Schema $schema): void
{
2023-08-05 19:35:09 +02:00
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting', true) . ' RENAME TO ' . $this->getTable('craue_config_setting', true));
break;
2023-08-05 19:35:09 +02:00
case $platform instanceof MySQLPlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME ' . $this->getTable('craue_config_setting'));
break;
2023-08-05 19:35:09 +02:00
case $platform instanceof PostgreSQLPlatform:
2019-08-08 15:19:53 +02:00
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting'));
break;
}
}
}