<?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 Version20240312135739 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// NOTE: COLUMN `health_report_submission_files.health_report_submissions_id`
// WAS LATER CHANGED TO `health_report_submission_id` (NO 's')
$this->addSql(
'CREATE TABLE health_report_submission_files (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
health_report_submissions_id INT UNSIGNED NOT NULL,
file_name VARCHAR(128) NOT NULL,
original_name VARCHAR(128) NOT NULL,
INDEX IDX_8371AB18825015F (health_report_submissions_id),
PRIMARY KEY(id))
DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
);
$this->addSql(
'CREATE TABLE health_report_submissions (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
cardio_metabolic_profile_id INT UNSIGNED DEFAULT NULL,
user_id INT UNSIGNED NOT NULL,
created_at DATETIME NOT NULL,
status ENUM(\'PENDING_OCR\', \'EDITABLE\', \'FINAL\')
DEFAULT \'PENDING_OCR\' NOT NULL
COMMENT \'(DC2Type:health_submission_status_enum_type)\',
INDEX IDX_B9DD585D7E454BA8 (cardio_metabolic_profile_id),
INDEX IDX_B9DD585DA76ED395 (user_id),
PRIMARY KEY(id))
DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'
);
$this->addSql(
'ALTER TABLE health_report_submission_files
ADD CONSTRAINT FK_8371AB18825015F
FOREIGN KEY (health_report_submissions_id)
REFERENCES health_report_submissions (id)
ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE health_report_submissions
ADD CONSTRAINT FK_B9DD585D7E454BA8
FOREIGN KEY (cardio_metabolic_profile_id)
REFERENCES cardiometabolic_profiles (id)
ON DELETE CASCADE'
);
$this->addSql(
'ALTER TABLE health_report_submissions
ADD CONSTRAINT FK_B9DD585DA76ED395
FOREIGN KEY (user_id)
REFERENCES users (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 health_report_submission_files
DROP FOREIGN KEY FK_8371AB18825015F'
);
$this->addSql(
'ALTER TABLE health_report_submissions
DROP FOREIGN KEY FK_B9DD585D7E454BA8'
);
$this->addSql(
'ALTER TABLE health_report_submissions
DROP FOREIGN KEY FK_B9DD585DA76ED395'
);
$this->addSql('DROP TABLE health_report_submissions');
$this->addSql('DROP TABLE health_report_submission_files');
}
}