<?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 Version20260209144602 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('CREATE TABLE strava_activity (id INT AUTO_INCREMENT NOT NULL, strava_profile_id INT NOT NULL, strava_activity_id BIGINT NOT NULL, category VARCHAR(20) NOT NULL, distance DOUBLE PRECISION NOT NULL, moving_time INT NOT NULL, elapsed_time INT NOT NULL, start_date DATETIME NOT NULL, start_date_local DATETIME NOT NULL, steps INT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, INDEX IDX_1661C9AE274E4EA4 (strava_profile_id), UNIQUE INDEX unique_strava_activity (strava_activity_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE strava_profile (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, strava_athlete_id BIGINT NOT NULL, access_token LONGTEXT NOT NULL, refresh_token LONGTEXT NOT NULL, expires_at INT NOT NULL, scope VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_44A15BFBA76ED395 (user_id), UNIQUE INDEX unique_strava_athlete (strava_athlete_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE strava_activity ADD CONSTRAINT FK_1661C9AE274E4EA4 FOREIGN KEY (strava_profile_id) REFERENCES strava_profile (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE strava_profile ADD CONSTRAINT FK_44A15BFBA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id) ON DELETE CASCADE');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE strava_activity DROP FOREIGN KEY FK_1661C9AE274E4EA4');
$this->addSql('ALTER TABLE strava_profile DROP FOREIGN KEY FK_44A15BFBA76ED395');
$this->addSql('DROP TABLE strava_activity');
$this->addSql('DROP TABLE strava_profile');
}
}