src/Migrations/Version20201022104230.php line 1
<?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 Version20201022104230 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 scholar_competence (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, caption VARCHAR(255) NOT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, active TINYINT(1) NOT NULL, INDEX IDX_194A3504B03A8386 (created_by_id), INDEX IDX_194A3504896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE scholar_profile (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, grade_id INT DEFAULT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, school VARCHAR(255) DEFAULT NULL, address LONGTEXT DEFAULT NULL, deleted TINYINT(1) DEFAULT \'0\' NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, active TINYINT(1) NOT NULL, UNIQUE INDEX UNIQ_14FBF773A76ED395 (user_id), INDEX IDX_14FBF773FE19A1A8 (grade_id), INDEX IDX_14FBF773B03A8386 (created_by_id), INDEX IDX_14FBF773896DBBDE (updated_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE profile_competence (profile_id INT NOT NULL, competence_id INT NOT NULL, INDEX IDX_53BF5F22CCFA12B8 (profile_id), INDEX IDX_53BF5F2215761DAB (competence_id), PRIMARY KEY(profile_id, competence_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE scholar_competence ADD CONSTRAINT FK_194A3504B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE scholar_competence ADD CONSTRAINT FK_194A3504896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE scholar_profile ADD CONSTRAINT FK_14FBF773A76ED395 FOREIGN KEY (user_id) REFERENCES organisation_user (id)');
$this->addSql('ALTER TABLE scholar_profile ADD CONSTRAINT FK_14FBF773FE19A1A8 FOREIGN KEY (grade_id) REFERENCES olympiad_grade (id)');
$this->addSql('ALTER TABLE scholar_profile ADD CONSTRAINT FK_14FBF773B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE scholar_profile ADD CONSTRAINT FK_14FBF773896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
$this->addSql('ALTER TABLE profile_competence ADD CONSTRAINT FK_53BF5F22CCFA12B8 FOREIGN KEY (profile_id) REFERENCES scholar_profile (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE profile_competence ADD CONSTRAINT FK_53BF5F2215761DAB FOREIGN KEY (competence_id) REFERENCES scholar_competence (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE users ADD birthday DATE DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE profile_competence DROP FOREIGN KEY FK_53BF5F2215761DAB');
$this->addSql('ALTER TABLE profile_competence DROP FOREIGN KEY FK_53BF5F22CCFA12B8');
$this->addSql('DROP TABLE scholar_competence');
$this->addSql('DROP TABLE scholar_profile');
$this->addSql('DROP TABLE profile_competence');
$this->addSql('ALTER TABLE users DROP birthday');
}
}