<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Types\Types;
use Doctrine\Migrations\AbstractMigration;
final class Version20250512164500 extends AbstractMigration
{
public function getDescription(): string
{
return 'Drop tariff table as it is no longer needed';
}
public function up(Schema $schema): void
{
$this->skipIf(
false === $schema->hasTable('tariff'),
'The tariff table is already removed!'
);
$schema->dropTable('tariff');
}
public function down(Schema $schema): void
{
$this->skipIf(
true === $schema->hasTable('tariff'),
'The tariff table already exists!'
);
$table = $schema->createTable('tariff');
$table->addColumn('id', Types::STRING)
->setNotnull(true);
$table->addColumn('cns_code', Types::STRING)
->setLength(40)
->setNotnull(true);
$table->addColumn('cns_tariff', Types::FLOAT)
->setNotnull(true);
$table->addColumn('available_from', Types::DATETIME_IMMUTABLE)
->setNotnull(false);
$table->addColumn('available_to', Types::DATETIME_IMMUTABLE)
->setNotnull(false);
$table->addColumn('created_at', Types::DATETIME_IMMUTABLE)
->setNotnull(true);
$table->addColumn('last_updated_at', Types::DATETIME_IMMUTABLE)
->setNotnull(true);
$table->addColumn('cns_id', Types::INTEGER)
->setNotnull(true);
$table->addColumn('label', Types::STRING)
->setLength(255)
->setNotnull(true);
$table->setPrimaryKey(['id']);
}
}