migrations/Version20220928162504.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 Version20220928162504 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 cal_accommodation_management (id INT AUTO_INCREMENT NOT NULL, internet_technical_area LONGTEXT DEFAULT NULL, has_management TINYINT(1) DEFAULT NULL, contact VARCHAR(100) DEFAULT NULL, email VARCHAR(100) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, management_fees INT DEFAULT NULL, rental_fees INT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
  19.         $this->addSql('ALTER TABLE cal_accommodation_contract ADD subscription_date DATE DEFAULT NULL, ADD phone VARCHAR(20) DEFAULT NULL');
  20.         $this->addSql('ALTER TABLE cal_accommodation_info ADD management_id INT DEFAULT NULL, ADD communal_heating TINYINT(1) DEFAULT NULL, ADD wifi_code VARCHAR(255) DEFAULT NULL, ADD maintenances_fees INT DEFAULT NULL, ADD min_maintenances_fees INT DEFAULT NULL');
  21.         $this->addSql('ALTER TABLE cal_accommodation_info ADD CONSTRAINT FK_6B3EF6D880D51D0E FOREIGN KEY (management_id) REFERENCES cal_accommodation_management (id)');
  22.         $this->addSql('CREATE UNIQUE INDEX UNIQ_6B3EF6D880D51D0E ON cal_accommodation_info (management_id)');
  23.         $this->addSql('ALTER TABLE cal_cleaning_recurrence ADD fees_type VARCHAR(50) DEFAULT NULL, ADD owner_fees INT DEFAULT NULL, ADD roommate_fees INT DEFAULT NULL');
  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('ALTER TABLE cal_accommodation_info DROP FOREIGN KEY FK_6B3EF6D880D51D0E');
  29.         $this->addSql('DROP TABLE cal_accommodation_management');
  30.         $this->addSql('ALTER TABLE cal_accommodation_contract DROP subscription_date, DROP phone');
  31.         $this->addSql('DROP INDEX UNIQ_6B3EF6D880D51D0E ON cal_accommodation_info');
  32.         $this->addSql('ALTER TABLE cal_accommodation_info DROP management_id, DROP communal_heating, DROP wifi_code, DROP maintenances_fees, DROP min_maintenances_fees');
  33.         $this->addSql('ALTER TABLE cal_cleaning_recurrence DROP fees_type, DROP owner_fees, DROP roommate_fees');
  34.     }
  35. }