Part-DB-server/migrations/Version20240905085300.php

49 lines
1.4 KiB
PHP
Raw Normal View History

2024-09-05 15:41:00 +02:00
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use App\Migration\AbstractMultiPlatformMigration;
use Doctrine\DBAL\Schema\Schema;
final class Version20240905085300 extends AbstractMultiPlatformMigration
{
public function getDescription(): string
{
return 'Added order fields';
}
public function mySQLUp(Schema $schema): void
{
2024-09-05 16:01:27 +02:00
$this->addSql('ALTER TABLE parts ADD orderamount DOUBLE PRECISION NOT NULL DEFAULT 0, ADD orderDelivery DATETIME');
2024-09-05 15:41:00 +02:00
}
public function mySQLDown(Schema $schema): void
{
2024-09-05 16:01:27 +02:00
$this->addSql('ALTER TABLE `parts` DROP orderamount, DROP orderDelivery');
2024-09-05 15:41:00 +02:00
}
2025-09-15 14:03:58 +02:00
public function postgreSQLUp(Schema $schema): void
{
$this->addSql('ALTER TABLE parts ADD orderamount DOUBLE PRECISION NOT NULL DEFAULT 0, ADD orderDelivery timestamp');
}
public function postgreSQLDown(Schema $schema): void
{
$this->addSql('ALTER TABLE parts DROP orderamount, DROP orderDelivery');
}
2024-09-05 15:41:00 +02:00
public function sqLiteUp(Schema $schema): void
{
$this->addSql('ALTER TABLE parts ADD COLUMN orderamount DOUBLE PRECISION NOT NULL DEFAULT 0');
2024-09-05 16:01:27 +02:00
$this->addSql('ALTER TABLE parts ADD COLUMN orderDelivery DATETIME');
2024-09-05 15:41:00 +02:00
}
public function sqLiteDown(Schema $schema): void
{
$error;
// TODO: implement backwards migration for SQlite
}
}