migrations/Version20200106055826.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 Version20200106055826 extends AbstractMigration
  10. {
  11.     public function getDescription() : string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema) : void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  19.         $this->addSql('CREATE TABLE employee (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, firstName VARCHAR(100) DEFAULT NULL, lastName VARCHAR(100) DEFAULT NULL, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX IDX_5D9F75A1A76ED395 (user_id), INDEX IDX_5D9F75A1B03A8386 (created_by_id), INDEX IDX_5D9F75A1896DBBDE (updated_by_id), FULLTEXT INDEX search (firstName, lastName), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  20.         
  21.         $this->addSql('UPDATE users SET is_active=0 WHERE id=8668');
  22.         $this->addSql('UPDATE users SET is_active=0 WHERE id=27570');
  23.         $this->addSql('INSERT INTO employee(user_id, firstName, lastName, active, created_by_id, created_at, updated_by_id, updated_at) SELECT users.id, users.name, "", users.is_active, 1, NOW(), 1, NOW() FROM users WHERE users.roles <> "ROLE_USER"');
  24.     }
  25.     public function down(Schema $schema) : void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  29.         $this->addSql('DROP TABLE employee');
  30.     }
  31. }