<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20231227131957 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('ALTER TABLE wages DROP CONSTRAINT FK_925439652832EB1C');
$this->addSql('ALTER TABLE wages DROP COLUMN reporting_period_id');
$this->addSql('ALTER TABLE wages ADD COLUMN reporting_period_id UUID NOT NULL');
$this->addSql('COMMENT ON COLUMN wages.reporting_period_id IS \'(DC2Type:uuid)\'');
$this->addSql(
'ALTER TABLE wages ADD CONSTRAINT FK_925439652832EB1C FOREIGN KEY (reporting_period_id) REFERENCES v2_reporting_period (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'
);
$this->addSql('ALTER TABLE transactions DROP CONSTRAINT fk_eaa81a4c2832eb1c');
$this->addSql('DROP INDEX idx_eaa81a4c2832eb1c');
$this->addSql('ALTER TABLE transactions DROP reporting_period_id');
}
public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE wages DROP CONSTRAINT FK_925439652832EB1C');
$this->addSql('ALTER TABLE wages DROP COLUMN reporting_period_id');
$this->addSql('ALTER TABLE wages ADD COLUMN reporting_period_id INT NOT NULL');
$this->addSql(
'ALTER TABLE wages ADD CONSTRAINT FK_925439652832EB1C FOREIGN KEY (reporting_period_id) REFERENCES reporting_periods (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'
);
$this->addSql('ALTER TABLE transactions ADD reporting_period_id INT NOT NULL');
$this->addSql('ALTER TABLE transactions ADD CONSTRAINT fk_eaa81a4c2832eb1c FOREIGN KEY (reporting_period_id) REFERENCES reporting_periods (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX idx_eaa81a4c2832eb1c ON transactions (reporting_period_id)');
}
public function preDown(Schema $schema): void
{
$this->connection->executeStatement('DELETE FROM transactions');
$this->connection->executeStatement('DELETE FROM wages');
}
public function preUp(Schema $schema): void
{
$this->connection->executeStatement('DELETE FROM transactions');
$this->connection->executeStatement('DELETE FROM wages');
}
}