vendor/plna-penezenka/pp-sdk-bundle/migrations/Version20220506182802_TipContestBonusTimeRange.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace PPSDKDoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. final class Version20220506182802_TipContestBonusTimeRange extends AbstractMigration
  7. {
  8.     public function getDescription(): string
  9.     {
  10.         return '';
  11.     }
  12.     public function up(Schema $schema): void
  13.     {
  14.         $this->addSql('
  15.             ALTER TABLE tip_contests 
  16.                 ADD transactions_bonus_enabled TINYINT(1) DEFAULT 1 NOT NULL,
  17.                 ADD transactions_bonus_active_from_when DATETIME DEFAULT NULL, 
  18.                 ADD transactions_bonus_active_to_when DATETIME DEFAULT NULL, 
  19.                 ADD points_definition_exact_score_hit_points INT DEFAULT 5 NOT NULL, 
  20.                 ADD points_definition_winner_or_tie_hit_points INT DEFAULT 3 NOT NULL, 
  21.                 ADD points_definition_team_score_hit_points INT DEFAULT 1 NOT NULL
  22.         ');
  23.         $this->addSql('
  24.             UPDATE tip_contests  
  25.             SET
  26.                 transactions_bonus_active_from_when = active_from_when,
  27.                 transactions_bonus_active_to_when = active_to_when
  28.             WHERE 1
  29.         ');
  30.         $this->addSql('
  31.             ALTER TABLE tip_contests 
  32.                 DROP active_from_when,
  33.                 DROP active_to_when
  34.         ');
  35.     }
  36.     public function down(Schema $schema): void
  37.     {
  38.         $this->addSql('
  39.         ALTER TABLE tip_contests 
  40.             ADD active_from_when DATETIME NOT NULL, 
  41.             ADD active_to_when DATETIME NOT NULL, 
  42.             DROP transactions_bonus_enabled, 
  43.             DROP transactions_bonus_active_from_when, 
  44.             DROP transactions_bonus_active_to_when, 
  45.             DROP points_definition_exact_score_hit_points,
  46.             DROP points_definition_winner_or_tie_hit_points, 
  47.             DROP points_definition_team_score_hit_points
  48.         ');
  49.     }
  50. }