migrations/Version20260609134731.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 Version20260609134731 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->addSql('CREATE TABLE team_invitation (id INT AUTO_INCREMENT NOT NULL, team_id INT NOT NULL, created_by_id INT NOT NULL, token VARCHAR(64) NOT NULL, expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, UNIQUE INDEX UNIQ_CFC413675F37A13B (token), INDEX IDX_CFC41367296CD8AE (team_id), INDEX IDX_CFC41367B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE team_invitation ADD CONSTRAINT FK_CFC41367296CD8AE FOREIGN KEY (team_id) REFERENCES team (id) ON DELETE CASCADE');
  20.         $this->addSql('ALTER TABLE team_invitation ADD CONSTRAINT FK_CFC41367B03A8386 FOREIGN KEY (created_by_id) REFERENCES `user` (id)');
  21.         $this->addSql('ALTER TABLE bike_log CHANGE distance_amount distance_amount NUMERIC(10, 2) DEFAULT \'0\' NOT NULL');
  22.         $this->addSql('ALTER TABLE run_log CHANGE distance_amount distance_amount NUMERIC(10, 2) DEFAULT \'0\' NOT NULL');
  23.         $this->addSql('ALTER TABLE teamplay_user_recap CHANGE total_bike_distance total_bike_distance NUMERIC(12, 2) DEFAULT \'0\' NOT NULL, CHANGE total_run_distance total_run_distance NUMERIC(12, 2) DEFAULT \'0\' NOT NULL, CHANGE team_total_bike_distance team_total_bike_distance NUMERIC(12, 2) DEFAULT \'0\' NOT NULL, CHANGE team_total_run_distance team_total_run_distance NUMERIC(12, 2) DEFAULT \'0\' NOT NULL');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('ALTER TABLE team_invitation DROP FOREIGN KEY FK_CFC41367296CD8AE');
  29.         $this->addSql('ALTER TABLE team_invitation DROP FOREIGN KEY FK_CFC41367B03A8386');
  30.         $this->addSql('DROP TABLE team_invitation');
  31.         $this->addSql('ALTER TABLE bike_log CHANGE distance_amount distance_amount NUMERIC(10, 2) DEFAULT \'0.00\' NOT NULL');
  32.         $this->addSql('ALTER TABLE run_log CHANGE distance_amount distance_amount NUMERIC(10, 2) DEFAULT \'0.00\' NOT NULL');
  33.         $this->addSql('ALTER TABLE teamplay_user_recap CHANGE total_bike_distance total_bike_distance NUMERIC(12, 2) DEFAULT \'0.00\' NOT NULL, CHANGE total_run_distance total_run_distance NUMERIC(12, 2) DEFAULT \'0.00\' NOT NULL, CHANGE team_total_bike_distance team_total_bike_distance NUMERIC(12, 2) DEFAULT \'0.00\' NOT NULL, CHANGE team_total_run_distance team_total_run_distance NUMERIC(12, 2) DEFAULT \'0.00\' NOT NULL');
  34.     }
  35. }