migrations/Version20210226154720.php line 1

Open in your IDE?
  1. <?php
  2. namespace DoctrineMigrations;
  3. use Doctrine\DBAL\Schema\Schema;
  4. use Doctrine\Migrations\AbstractMigration;
  5. /**
  6.  * Auto-generated Migration: Please modify to your needs!
  7.  */
  8. class Version20210226154720 extends AbstractMigration
  9. {
  10.     public function up(Schema $schema): void
  11.     {
  12.         // this up() migration is auto-generated, please modify it to your needs
  13.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  14.         $this->addSql('ALTER TABLE work_log ADD user_cost_multiplier NUMERIC(8, 2) DEFAULT NULL, ADD labour_cost_multiplier NUMERIC(8, 2) DEFAULT NULL, ADD travel_cost_multiplier NUMERIC(8, 2) DEFAULT NULL');
  15.         $this->addSql('ALTER TABLE user ADD cost_multiplier NUMERIC(8, 2) DEFAULT NULL');
  16.         $this->addSql('UPDATE user SET cost_multiplier=1');
  17.         $this->addSql('UPDATE work_log SET user_cost_multiplier=1, labour_cost_multiplier=1, travel_cost_multiplier=1');
  18.     }
  19.     public function down(Schema $schema): void
  20.     {
  21.         // this down() migration is auto-generated, please modify it to your needs
  22.         $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql''Migration can only be executed safely on \'mysql\'.');
  23.         $this->addSql('ALTER TABLE user DROP cost_multiplier');
  24.         $this->addSql('ALTER TABLE work_log DROP user_cost_multiplier, DROP labour_cost_multiplier, DROP travel_cost_multiplier');
  25.     }
  26. }