migrations/Version20220729000743.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20220729000743 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $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');
  19.         $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');
  20.         $this->addSql('ALTER TABLE mobile_parent_app_account ADD CONSTRAINT FK_7CC8A7B58565851 FOREIGN KEY (establishment_id) REFERENCES establishment (id)');
  21.         $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');
  22.         $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');
  23.         $this->addSql('ALTER TABLE setting_level ADD parent_id INT DEFAULT NULL');
  24.         $this->addSql('ALTER TABLE setting_level ADD CONSTRAINT FK_D3423F72727ACA70 FOREIGN KEY (parent_id) REFERENCES setting_level (id)');
  25.         $this->addSql('CREATE INDEX IDX_D3423F72727ACA70 ON setting_level (parent_id)');
  26.     }
  27.     public function down(Schema $schema): void
  28.     {
  29.         // this down() migration is auto-generated, please modify it to your needs
  30.         $this->addSql('ALTER TABLE mobile_parent_app_account_registration_student DROP FOREIGN KEY FK_B24F2B19D12D991B');
  31.         $this->addSql('DROP TABLE mobile_parent_app_account');
  32.         $this->addSql('DROP TABLE mobile_parent_app_account_registration_student');
  33.         $this->addSql('ALTER TABLE setting_level DROP FOREIGN KEY FK_D3423F72727ACA70');
  34.         $this->addSql('DROP INDEX IDX_D3423F72727ACA70 ON setting_level');
  35.         $this->addSql('ALTER TABLE setting_level DROP parent_id');
  36.     }
  37. }