<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220128075556 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE athlete_token DROP FOREIGN KEY FK_593CB896D36AF002');
$this->addSql('ALTER TABLE web_hook_queue DROP FOREIGN KEY FK_E77D40DFD36AF002');
$this->addSql('DROP TABLE athlete');
$this->addSql('DROP TABLE athlete_token');
$this->addSql('DROP TABLE web_hook_queue');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE athlete (strava_id INT NOT NULL, username VARCHAR(180) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, refresh_token VARCHAR(180) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, roles JSON CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, UNIQUE INDEX UNIQ_C03B8321F85E0677 (username), PRIMARY KEY(strava_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE athlete_token (access_token VARCHAR(180) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, strava_id INT DEFAULT NULL, expired_at DATETIME NOT NULL, scope VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, UNIQUE INDEX UNIQ_593CB896D36AF002 (strava_id), PRIMARY KEY(access_token)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('CREATE TABLE web_hook_queue (id INT AUTO_INCREMENT NOT NULL, strava_id INT DEFAULT NULL, aspect_type VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, event_time INT NOT NULL, object_type VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, object_id INT NOT NULL, INDEX IDX_E77D40DFD36AF002 (strava_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' ');
$this->addSql('ALTER TABLE athlete_token ADD CONSTRAINT FK_593CB896D36AF002 FOREIGN KEY (strava_id) REFERENCES athlete (strava_id)');
$this->addSql('ALTER TABLE web_hook_queue ADD CONSTRAINT FK_E77D40DFD36AF002 FOREIGN KEY (strava_id) REFERENCES athlete (strava_id)');
}
}