<?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 Version20250715091147 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 external_adherent_data (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', adherent_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', external_data_age_group_id INT DEFAULT NULL, external_data_cc_member_status_id INT DEFAULT NULL, birth_year INT DEFAULT NULL, age_income_ratio_group INT DEFAULT NULL, household_income_ratio_group INT DEFAULT NULL, external_id VARCHAR(255) DEFAULT NULL, cohort VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_791F593A25F06C53 (adherent_id), INDEX IDX_791F593A3D72A779 (external_data_age_group_id), INDEX IDX_791F593AC1CBBD4F (external_data_cc_member_status_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE external_adherent_dated_data (id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', adherent_id CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', year INT NOT NULL, household_unit_shares DOUBLE PRECISION DEFAULT NULL, annual_income INT DEFAULT NULL, monthly_income INT DEFAULT NULL, UNIQUE INDEX UNIQ_23A421FE25F06C53 (adherent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE external_data_age_group (id INT AUTO_INCREMENT NOT NULL, age_group VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
        $this->addSql('CREATE TABLE external_data_cc_member_status (id INT AUTO_INCREMENT NOT NULL, member_status VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE `utf8_general_ci` ENGINE = InnoDB');
        $this->addSql('ALTER TABLE external_adherent_data ADD CONSTRAINT FK_791F593A25F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)');
        $this->addSql('ALTER TABLE external_adherent_data ADD CONSTRAINT FK_791F593A3D72A779 FOREIGN KEY (external_data_age_group_id) REFERENCES external_data_age_group (id)');
        $this->addSql('ALTER TABLE external_adherent_data ADD CONSTRAINT FK_791F593AC1CBBD4F FOREIGN KEY (external_data_cc_member_status_id) REFERENCES external_data_cc_member_status (id)');
        $this->addSql('ALTER TABLE external_adherent_dated_data ADD CONSTRAINT FK_23A421FE25F06C53 FOREIGN KEY (adherent_id) REFERENCES adherent (id)');
    }

    public function down(Schema $schema) : void
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->addSql('ALTER TABLE external_adherent_data DROP FOREIGN KEY FK_791F593A3D72A779');
        $this->addSql('ALTER TABLE external_adherent_data DROP FOREIGN KEY FK_791F593AC1CBBD4F');
        $this->addSql('DROP TABLE external_adherent_data');
        $this->addSql('DROP TABLE external_adherent_dated_data');
        $this->addSql('DROP TABLE external_data_age_group');
        $this->addSql('DROP TABLE external_data_cc_member_status');
    }
}
