src/Migrations/Version20210422143205.php line 1

  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 Version20210422143205 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 content_faq (id INT AUTO_INCREMENT NOT NULL, created_by_id INT DEFAULT NULL, updated_by_id INT DEFAULT NULL, question LONGTEXT DEFAULT NULL, answer 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) DEFAULT \'1\' NOT NULL, weight INT DEFAULT 10 NOT NULL, owner_uuid VARCHAR(36) DEFAULT NULL, owner_active TINYINT(1) DEFAULT \'1\' NOT NULL, owner_deleted TINYINT(1) DEFAULT \'0\' NOT NULL, INDEX IDX_5D142339B03A8386 (created_by_id), INDEX IDX_5D142339896DBBDE (updated_by_id), INDEX idx_owner (owner_uuid, deleted, active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE content_faq ADD CONSTRAINT FK_5D142339B03A8386 FOREIGN KEY (created_by_id) REFERENCES users (id)');
  20.         $this->addSql('ALTER TABLE content_faq ADD CONSTRAINT FK_5D142339896DBBDE FOREIGN KEY (updated_by_id) REFERENCES users (id)');
  21.         $this->addSql('DROP INDEX idx_active ON content_textblock');
  22.         $this->addSql('DROP INDEX idx_url ON content_textblock');
  23.         $this->addSql('CREATE INDEX idx_show ON content_textblock (slug, owner_uuid, deleted, active)');
  24.     }
  25.     public function down(Schema $schema): void
  26.     {
  27.         // this down() migration is auto-generated, please modify it to your needs
  28.         $this->addSql('DROP TABLE content_faq');
  29.         $this->addSql('DROP INDEX idx_show ON content_textblock');
  30.         $this->addSql('CREATE INDEX idx_active ON content_textblock (active)');
  31.         $this->addSql('CREATE INDEX idx_url ON content_textblock (slug)');
  32.     }
  33. }