<?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 Version20210520044004 extends AbstractMigration
{
public function getDescription(): string
{
return 'alter type to TIMESTAMP to date_hiring, date_dismissal in table developer, date_singing in project. add field user_id in time_norm_day';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE developer ALTER date_hiring TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE developer ALTER date_hiring DROP DEFAULT');
$this->addSql('ALTER TABLE developer ALTER date_dismissal TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE developer ALTER date_dismissal DROP DEFAULT');
$this->addSql('ALTER TABLE project ALTER date_singing TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE project ALTER date_singing DROP DEFAULT');
$this->addSql('ALTER TABLE time_norm_day ADD user_id UUID DEFAULT NULL');
$this->addSql('ALTER TABLE time_norm_day ALTER date TYPE DATE');
$this->addSql('ALTER TABLE time_norm_day ALTER date DROP DEFAULT');
$this->addSql('COMMENT ON COLUMN time_norm_day.user_id IS \'(DC2Type:uuid)\'');
$this->addSql('ALTER TABLE time_norm_day ADD CONSTRAINT FK_D7FFE260A76ED395 FOREIGN KEY (user_id) REFERENCES hub_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('CREATE INDEX IDX_D7FFE260A76ED395 ON time_norm_day (user_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE time_norm_day DROP CONSTRAINT FK_D7FFE260A76ED395');
$this->addSql('DROP INDEX IDX_D7FFE260A76ED395');
$this->addSql('ALTER TABLE time_norm_day DROP user_id');
$this->addSql('ALTER TABLE time_norm_day ALTER date TYPE DATE');
$this->addSql('ALTER TABLE time_norm_day ALTER date DROP DEFAULT');
$this->addSql('ALTER TABLE developer ALTER date_hiring TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE developer ALTER date_hiring DROP DEFAULT');
$this->addSql('ALTER TABLE developer ALTER date_dismissal TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE developer ALTER date_dismissal DROP DEFAULT');
$this->addSql('ALTER TABLE project ALTER date_singing TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
$this->addSql('ALTER TABLE project ALTER date_singing DROP DEFAULT');
}
}