migrations/Version20210816145519.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 Version20210816145519 extends AbstractMigration
  10. {
  11. public function getDescription() : string
  12. {
  13. return '';
  14. }
  15. public function up(Schema $schema) : void
  16. {
  17. $this->addSql('CREATE TABLE manager_notifications (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, resident_id INT NOT NULL, flat_id INT NOT NULL, type INT NOT NULL, content VARCHAR(1024) NOT NULL, status INT DEFAULT NULL, created_at DATETIME NOT NULL, INDEX IDX_97A98362A76ED395 (user_id), INDEX IDX_97A983628012C5B0 (resident_id), INDEX IDX_97A98362D3331C94 (flat_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  18. $this->addSql('ALTER TABLE manager_notifications ADD CONSTRAINT FK_97A98362A76ED395 FOREIGN KEY (user_id) REFERENCES fos_user (id)');
  19. $this->addSql('ALTER TABLE manager_notifications ADD CONSTRAINT FK_97A983628012C5B0 FOREIGN KEY (resident_id) REFERENCES residents (id)');
  20. $this->addSql('ALTER TABLE manager_notifications ADD CONSTRAINT FK_97A98362D3331C94 FOREIGN KEY (flat_id) REFERENCES flat (id)');
  21. }
  22. public function down(Schema $schema) : void
  23. {
  24. $this->addSql('DROP TABLE manager_notifications');
  25. }
  26. }