| Total Complexity | 7 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 12 | class Version20180904180000 extends AbstractMigrationChamilo |
||
| 13 | { |
||
| 14 | public function getDescription(): string |
||
| 17 | } |
||
| 18 | |||
| 19 | public function up(Schema $schema): void |
||
| 20 | { |
||
| 21 | $table = $schema->getTable('sys_calendar'); |
||
| 22 | |||
| 23 | $this->addSql('ALTER TABLE sys_calendar CHANGE access_url_id access_url_id INT DEFAULT NULL'); |
||
| 24 | |||
| 25 | if (!$table->hasForeignKey('FK_1670370E73444FD5')) { |
||
| 26 | $this->addSql('ALTER TABLE sys_calendar ADD CONSTRAINT FK_1670370E73444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id) ON DELETE CASCADE'); |
||
| 27 | } |
||
| 28 | |||
| 29 | if (!$table->hasIndex('IDX_1670370E73444FD5')) { |
||
| 30 | $this->addSql('CREATE INDEX IDX_1670370E73444FD5 ON sys_calendar (access_url_id)'); |
||
| 31 | } |
||
| 32 | |||
| 33 | $table = $schema->getTable('sys_announcement'); |
||
| 34 | |||
| 35 | $this->addSql('ALTER TABLE sys_announcement CHANGE access_url_id access_url_id INT DEFAULT NULL'); |
||
| 36 | if (!$table->hasForeignKey('FK_E4A3EAD473444FD5')) { |
||
| 37 | $this->addSql( |
||
| 38 | 'ALTER TABLE sys_announcement ADD CONSTRAINT FK_E4A3EAD473444FD5 FOREIGN KEY (access_url_id) REFERENCES access_url (id) ON DELETE CASCADE' |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | if (!$table->hasIndex('IDX_E4A3EAD473444FD5')) { |
||
| 42 | $this->addSql('CREATE INDEX IDX_E4A3EAD473444FD5 ON sys_announcement (access_url_id)'); |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | public function down(Schema $schema): void |
||
| 48 | } |
||
| 49 | } |
||
| 50 |