migrations/Version20210520044004.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20210520044004 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         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';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE developer ALTER date_hiring TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  19.         $this->addSql('ALTER TABLE developer ALTER date_hiring DROP DEFAULT');
  20.         $this->addSql('ALTER TABLE developer ALTER date_dismissal TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  21.         $this->addSql('ALTER TABLE developer ALTER date_dismissal DROP DEFAULT');
  22.         $this->addSql('ALTER TABLE project ALTER date_singing TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  23.         $this->addSql('ALTER TABLE project ALTER date_singing DROP DEFAULT');
  24.         $this->addSql('ALTER TABLE time_norm_day ADD user_id UUID DEFAULT NULL');
  25.         $this->addSql('ALTER TABLE time_norm_day ALTER date TYPE DATE');
  26.         $this->addSql('ALTER TABLE time_norm_day ALTER date DROP DEFAULT');
  27.         $this->addSql('COMMENT ON COLUMN time_norm_day.user_id IS \'(DC2Type:uuid)\'');
  28.         $this->addSql('ALTER TABLE time_norm_day ADD CONSTRAINT FK_D7FFE260A76ED395 FOREIGN KEY (user_id) REFERENCES hub_user (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
  29.         $this->addSql('CREATE INDEX IDX_D7FFE260A76ED395 ON time_norm_day (user_id)');
  30.     }
  31.     public function down(Schema $schema): void
  32.     {
  33.         // this down() migration is auto-generated, please modify it to your needs
  34.         $this->addSql('ALTER TABLE time_norm_day DROP CONSTRAINT FK_D7FFE260A76ED395');
  35.         $this->addSql('DROP INDEX IDX_D7FFE260A76ED395');
  36.         $this->addSql('ALTER TABLE time_norm_day DROP user_id');
  37.         $this->addSql('ALTER TABLE time_norm_day ALTER date TYPE DATE');
  38.         $this->addSql('ALTER TABLE time_norm_day ALTER date DROP DEFAULT');
  39.         $this->addSql('ALTER TABLE developer ALTER date_hiring TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  40.         $this->addSql('ALTER TABLE developer ALTER date_hiring DROP DEFAULT');
  41.         $this->addSql('ALTER TABLE developer ALTER date_dismissal TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  42.         $this->addSql('ALTER TABLE developer ALTER date_dismissal DROP DEFAULT');
  43.         $this->addSql('ALTER TABLE project ALTER date_singing TYPE TIMESTAMP(0) WITHOUT TIME ZONE');
  44.         $this->addSql('ALTER TABLE project ALTER date_singing DROP DEFAULT');
  45.     }
  46. }