<?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 Version20220729000743 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 mobile_parent_app_account (id INT AUTO_INCREMENT NOT NULL, establishment_id INT NOT NULL, last_name VARCHAR(128) NOT NULL, first_name VARCHAR(128) NOT NULL, phone_number VARCHAR(128) NOT NULL, username VARCHAR(180) NOT NULL, password VARCHAR(255) NOT NULL, is_enabled TINYINT(1) NOT NULL, is_password_changed TINYINT(1) NOT NULL, last_auth_time INT DEFAULT NULL, token VARCHAR(255) DEFAULT NULL, create_at DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_by INT NOT NULL, updated_by INT NOT NULL, UNIQUE INDEX UNIQ_7CC8A7B5F85E0677 (username), INDEX IDX_7CC8A7B58565851 (establishment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE mobile_parent_app_account_registration_student (mobile_parent_app_account_id INT NOT NULL, registration_student_id INT NOT NULL, INDEX IDX_B24F2B19D12D991B (mobile_parent_app_account_id), INDEX IDX_B24F2B19F6AF8633 (registration_student_id), PRIMARY KEY(mobile_parent_app_account_id, registration_student_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE mobile_parent_app_account ADD CONSTRAINT FK_7CC8A7B58565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
$this->addSql('ALTER TABLE mobile_parent_app_account_registration_student ADD CONSTRAINT FK_B24F2B19D12D991B FOREIGN KEY (mobile_parent_app_account_id) REFERENCES mobile_parent_app_account (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE mobile_parent_app_account_registration_student ADD CONSTRAINT FK_B24F2B19F6AF8633 FOREIGN KEY (registration_student_id) REFERENCES registration_student (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE setting_level ADD parent_id INT DEFAULT NULL');
$this->addSql('ALTER TABLE setting_level ADD CONSTRAINT FK_D3423F72727ACA70 FOREIGN KEY (parent_id) REFERENCES setting_level (id)');
$this->addSql('CREATE INDEX IDX_D3423F72727ACA70 ON setting_level (parent_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mobile_parent_app_account_registration_student DROP FOREIGN KEY FK_B24F2B19D12D991B');
$this->addSql('DROP TABLE mobile_parent_app_account');
$this->addSql('DROP TABLE mobile_parent_app_account_registration_student');
$this->addSql('ALTER TABLE setting_level DROP FOREIGN KEY FK_D3423F72727ACA70');
$this->addSql('DROP INDEX IDX_D3423F72727ACA70 ON setting_level');
$this->addSql('ALTER TABLE setting_level DROP parent_id');
}
}