| Conditions | 59 |
| Paths | 0 |
| Total Lines | 365 |
| Code Lines | 188 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 17 | public function up(Schema $schema): void |
||
| 18 | { |
||
| 19 | $table = $schema->getTable('c_thematic'); |
||
| 20 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 21 | $this->addSql('ALTER TABLE c_thematic ADD resource_node_id INT DEFAULT NULL'); |
||
| 22 | $this->addSql( |
||
| 23 | 'ALTER TABLE c_thematic ADD CONSTRAINT FK_6D8F59B91BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 24 | ); |
||
| 25 | $this->addSql('CREATE UNIQUE INDEX UNIQ_6D8F59B91BAD783F ON c_thematic (resource_node_id)'); |
||
| 26 | } |
||
| 27 | |||
| 28 | if ($table->hasIndex('course')) { |
||
| 29 | $this->addSql('DROP INDEX course ON c_thematic'); |
||
| 30 | } |
||
| 31 | if ($table->hasIndex('active')) { |
||
| 32 | $this->addSql('DROP INDEX active ON c_thematic'); |
||
| 33 | } |
||
| 34 | |||
| 35 | if ($table->hasColumn('c_id')) { |
||
| 36 | //$this->addSql('ALTER TABLE c_thematic DROP c_id'); |
||
| 37 | } |
||
| 38 | |||
| 39 | if ($table->hasColumn('session_id')) { |
||
| 40 | //$this->addSql('ALTER TABLE c_thematic DROP session_id'); |
||
| 41 | } |
||
| 42 | |||
| 43 | if ($table->hasIndex('active')) { |
||
| 44 | $this->addSql('CREATE INDEX active ON c_thematic (active);'); |
||
| 45 | } |
||
| 46 | |||
| 47 | $table = $schema->getTable('c_thematic_advance'); |
||
| 48 | if ($table->hasIndex('course')) { |
||
| 49 | $this->addSql('DROP INDEX course ON c_thematic_advance'); |
||
| 50 | } |
||
| 51 | |||
| 52 | if ($table->hasColumn('c_id')) { |
||
| 53 | //$this->addSql('ALTER TABLE c_thematic_advance DROP c_id;'); |
||
| 54 | } |
||
| 55 | |||
| 56 | if ($table->hasIndex('thematic_id')) { |
||
| 57 | $this->addSql('DROP INDEX thematic_id ON c_thematic_advance'); |
||
| 58 | } |
||
| 59 | |||
| 60 | if (false === $table->hasIndex('IDX_62798E972395FCED')) { |
||
| 61 | $this->addSql('CREATE INDEX IDX_62798E972395FCED ON c_thematic_advance (thematic_id)'); |
||
| 62 | } |
||
| 63 | |||
| 64 | $this->addSql( |
||
| 65 | 'ALTER TABLE c_thematic_advance CHANGE thematic_id thematic_id INT DEFAULT NULL, CHANGE attendance_id attendance_id INT DEFAULT NULL' |
||
| 66 | ); |
||
| 67 | |||
| 68 | if (false === $table->hasForeignKey('FK_62798E972395FCED')) { |
||
| 69 | $this->addSql( |
||
| 70 | 'ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E972395FCED FOREIGN KEY (thematic_id) REFERENCES c_thematic (iid)' |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | if (false === $table->hasForeignKey('FK_62798E97163DDA15')) { |
||
| 74 | $this->addSql( |
||
| 75 | 'ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E97163DDA15 FOREIGN KEY (attendance_id) REFERENCES c_attendance (iid)' |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | if (false === $table->hasIndex('IDX_62798E97163DDA15')) { |
||
| 79 | $this->addSql('CREATE INDEX IDX_62798E97163DDA15 ON c_thematic_advance (attendance_id);'); |
||
| 80 | } |
||
| 81 | |||
| 82 | /* |
||
| 83 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 84 | $this->addSql('ALTER TABLE c_thematic_advance ADD resource_node_id INT DEFAULT NULL'); |
||
| 85 | |||
| 86 | //$this->addSql('ALTER TABLE c_thematic_advance ADD CONSTRAINT FK_62798E971BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); |
||
| 87 | $this->addSql('CREATE UNIQUE INDEX UNIQ_62798E971BAD783F ON c_thematic_advance (resource_node_id)'); |
||
| 88 | }*/ |
||
| 89 | |||
| 90 | $table = $schema->getTable('c_thematic_plan'); |
||
| 91 | $this->addSql('ALTER TABLE c_thematic_plan CHANGE thematic_id thematic_id INT DEFAULT NULL'); |
||
| 92 | |||
| 93 | if ($table->hasIndex('course')) { |
||
| 94 | $this->addSql('DROP INDEX course ON c_thematic_plan'); |
||
| 95 | } |
||
| 96 | |||
| 97 | if ($table->hasColumn('c_id')) { |
||
| 98 | //$this->addSql('ALTER TABLE c_thematic_plan DROP c_id;'); |
||
| 99 | } |
||
| 100 | if (false === $table->hasForeignKey('FK_1197487C2395FCED')) { |
||
| 101 | $this->addSql( |
||
| 102 | 'ALTER TABLE c_thematic_plan ADD CONSTRAINT FK_1197487C2395FCED FOREIGN KEY (thematic_id) REFERENCES c_thematic (iid)' |
||
| 103 | ); |
||
| 104 | } |
||
| 105 | |||
| 106 | if (false === $table->hasIndex('IDX_1197487C2395FCED')) { |
||
| 107 | $this->addSql('CREATE INDEX IDX_1197487C2395FCED ON c_thematic_plan (thematic_id)'); |
||
| 108 | } |
||
| 109 | |||
| 110 | /* |
||
| 111 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 112 | $this->addSql('ALTER TABLE c_thematic_plan ADD resource_node_id INT DEFAULT NULL'); |
||
| 113 | |||
| 114 | $this->addSql('ALTER TABLE c_thematic_plan ADD CONSTRAINT FK_1197487C1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE'); |
||
| 115 | $this->addSql('CREATE UNIQUE INDEX UNIQ_1197487C1BAD783F ON c_thematic_plan (resource_node_id)'); |
||
| 116 | }*/ |
||
| 117 | |||
| 118 | // CLink |
||
| 119 | $table = $schema->getTable('c_link'); |
||
| 120 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 121 | $this->addSql('ALTER TABLE c_link ADD resource_node_id INT DEFAULT NULL;'); |
||
| 122 | $this->addSql( |
||
| 123 | 'ALTER TABLE c_link ADD CONSTRAINT FK_9209C2A01BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' |
||
| 124 | ); |
||
| 125 | $this->addSql('CREATE UNIQUE INDEX UNIQ_9209C2A01BAD783F ON c_link (resource_node_id);'); |
||
| 126 | } |
||
| 127 | |||
| 128 | if ($table->hasIndex('session_id')) { |
||
| 129 | $this->addSql('DROP INDEX session_id ON c_link'); |
||
| 130 | } |
||
| 131 | if ($table->hasIndex('course')) { |
||
| 132 | $this->addSql('DROP INDEX course ON c_link'); |
||
| 133 | } |
||
| 134 | |||
| 135 | $this->addSql('UPDATE c_link SET category_id = NULL WHERE category_id = 0'); |
||
| 136 | if (false === $table->hasForeignKey('FK_9209C2A012469DE2')) { |
||
| 137 | $this->addSql( |
||
| 138 | 'ALTER TABLE c_link ADD CONSTRAINT FK_9209C2A012469DE2 FOREIGN KEY (category_id) REFERENCES c_link_category (iid)' |
||
| 139 | ); |
||
| 140 | $this->addSql('CREATE INDEX IDX_9209C2A012469DE2 ON c_link (category_id)'); |
||
| 141 | } |
||
| 142 | |||
| 143 | $table = $schema->getTable('c_link_category'); |
||
| 144 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 145 | $this->addSql('ALTER TABLE c_link_category ADD resource_node_id INT DEFAULT NULL'); |
||
| 146 | $this->addSql( |
||
| 147 | 'ALTER TABLE c_link_category ADD CONSTRAINT FK_319D6C9C1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 148 | ); |
||
| 149 | $this->addSql('CREATE UNIQUE INDEX UNIQ_319D6C9C1BAD783F ON c_link_category (resource_node_id)'); |
||
| 150 | } |
||
| 151 | if ($table->hasIndex('session_id')) { |
||
| 152 | $this->addSql('DROP INDEX session_id ON c_link_category'); |
||
| 153 | } |
||
| 154 | if ($table->hasIndex('course')) { |
||
| 155 | $this->addSql('DROP INDEX course ON c_link_category'); |
||
| 156 | } |
||
| 157 | |||
| 158 | $table = $schema->getTable('c_glossary'); |
||
| 159 | |||
| 160 | if ($table->hasIndex('course')) { |
||
| 161 | $this->addSql('DROP INDEX course ON c_glossary'); |
||
| 162 | } |
||
| 163 | |||
| 164 | if ($table->hasIndex('session_id')) { |
||
| 165 | $this->addSql('DROP INDEX session_id ON c_glossary'); |
||
| 166 | } |
||
| 167 | |||
| 168 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 169 | $this->addSql('ALTER TABLE c_glossary ADD resource_node_id INT DEFAULT NULL'); |
||
| 170 | $this->addSql( |
||
| 171 | 'ALTER TABLE c_glossary ADD CONSTRAINT FK_A1168D881BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 172 | ); |
||
| 173 | $this->addSql('CREATE UNIQUE INDEX UNIQ_A1168D881BAD783F ON c_glossary (resource_node_id)'); |
||
| 174 | } |
||
| 175 | |||
| 176 | $table = $schema->getTable('c_student_publication'); |
||
| 177 | |||
| 178 | $this->addSql('UPDATE c_student_publication SET user_id = NULL WHERE user_id = 0'); |
||
| 179 | $this->addSql('ALTER TABLE c_student_publication CHANGE user_id user_id INT DEFAULT NULL'); |
||
| 180 | |||
| 181 | if (false === $table->hasForeignKey('FK_5246F746A76ED395')) { |
||
| 182 | $this->addSql('ALTER TABLE c_student_publication ADD CONSTRAINT FK_5246F746A76ED395 FOREIGN KEY (user_id) REFERENCES user (id);'); |
||
| 183 | } |
||
| 184 | |||
| 185 | if ($table->hasIndex('idx_csp_u')) { |
||
| 186 | $this->addSql('DROP INDEX idx_csp_u ON c_student_publication'); |
||
| 187 | } |
||
| 188 | |||
| 189 | if (false === $table->hasIndex('IDX_5246F746A76ED395')) { |
||
| 190 | $this->addSql('CREATE INDEX IDX_5246F746A76ED395 ON c_student_publication (user_id);'); |
||
| 191 | } |
||
| 192 | |||
| 193 | $this->addSql('UPDATE c_student_publication SET parent_id = NULL WHERE parent_id = 0'); |
||
| 194 | $this->addSql('ALTER TABLE c_student_publication CHANGE parent_id parent_id INT DEFAULT NULL'); |
||
| 195 | |||
| 196 | if (false === $table->hasForeignKey('FK_5246F746727ACA70')) { |
||
| 197 | $this->addSql('ALTER TABLE c_student_publication ADD CONSTRAINT FK_5246F746727ACA70 FOREIGN KEY (parent_id) REFERENCES c_student_publication (iid);'); |
||
| 198 | } |
||
| 199 | |||
| 200 | if (false === $table->hasIndex('IDX_5246F746727ACA70')) { |
||
| 201 | $this->addSql('CREATE INDEX IDX_5246F746727ACA70 ON c_student_publication (parent_id)'); |
||
| 202 | } |
||
| 203 | |||
| 204 | if (false === $table->hasColumn('filesize')) { |
||
| 205 | $this->addSql('ALTER TABLE c_student_publication ADD filesize INT DEFAULT NULL'); |
||
| 206 | } |
||
| 207 | |||
| 208 | if ($table->hasForeignKey('FK_5246F746613FECDF')) { |
||
| 209 | $this->addSql('ALTER TABLE c_student_publication DROP FOREIGN KEY FK_5246F746613FECDF;'); |
||
| 210 | } |
||
| 211 | |||
| 212 | if ($table->hasIndex('course')) { |
||
| 213 | $this->addSql('DROP INDEX course ON c_student_publication;'); |
||
| 214 | } |
||
| 215 | |||
| 216 | $this->addSql('ALTER TABLE c_student_publication CHANGE url url VARCHAR(500) DEFAULT NULL'); |
||
| 217 | $this->addSql( |
||
| 218 | 'ALTER TABLE c_student_publication CHANGE url_correction url_correction VARCHAR(500) DEFAULT NULL' |
||
| 219 | ); |
||
| 220 | $this->addSql('ALTER TABLE c_student_publication CHANGE active active INT DEFAULT NULL'); |
||
| 221 | |||
| 222 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 223 | $this->addSql('ALTER TABLE c_student_publication ADD resource_node_id INT DEFAULT NULL'); |
||
| 224 | $this->addSql( |
||
| 225 | 'ALTER TABLE c_student_publication ADD CONSTRAINT FK_5246F7461BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 226 | ); |
||
| 227 | $this->addSql('CREATE UNIQUE INDEX UNIQ_5246F7461BAD783F ON c_student_publication (resource_node_id)'); |
||
| 228 | } |
||
| 229 | |||
| 230 | $table = $schema->getTable('c_student_publication_assignment'); |
||
| 231 | /* |
||
| 232 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 233 | $this->addSql('ALTER TABLE c_student_publication_assignment ADD resource_node_id INT DEFAULT NULL'); |
||
| 234 | $this->addSql( |
||
| 235 | 'ALTER TABLE c_student_publication_assignment ADD CONSTRAINT FK_25687EB81BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 236 | ); |
||
| 237 | $this->addSql( |
||
| 238 | 'CREATE UNIQUE INDEX UNIQ_25687EB81BAD783F ON c_student_publication_assignment (resource_node_id)' |
||
| 239 | ); |
||
| 240 | } |
||
| 241 | */ |
||
| 242 | |||
| 243 | $this->addSql('UPDATE c_student_publication_assignment SET publication_id = NULL WHERE publication_id = 0'); |
||
| 244 | $this->addSql('ALTER TABLE c_student_publication_assignment CHANGE publication_id publication_id INT DEFAULT NULL'); |
||
| 245 | |||
| 246 | if (false === $table->hasForeignKey('FK_25687EB838B217A7')) { |
||
| 247 | $this->addSql('ALTER TABLE c_student_publication_assignment ADD CONSTRAINT FK_25687EB838B217A7 FOREIGN KEY (publication_id) REFERENCES c_student_publication (iid) ON DELETE CASCADE;'); |
||
| 248 | } |
||
| 249 | |||
| 250 | if (false === $table->hasIndex('UNIQ_25687EB838B217A7')) { |
||
| 251 | $this->addSql('ALTER TABLE c_student_publication_assignment ADD UNIQUE INDEX UNIQ_25687EB838B217A7 (publication_id)'); |
||
| 252 | } |
||
| 253 | |||
| 254 | if (false === $schema->hasTable('c_student_publication_correction')) { |
||
| 255 | $this->addSql( |
||
| 256 | 'CREATE TABLE c_student_publication_correction (id INT AUTO_INCREMENT NOT NULL, resource_node_id INT DEFAULT NULL, title VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_B7309BBA1BAD783F (resource_node_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB ROW_FORMAT = DYNAMIC' |
||
| 257 | ); |
||
| 258 | $this->addSql( |
||
| 259 | 'ALTER TABLE c_student_publication_correction ADD CONSTRAINT FK_B7309BBA1BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE;' |
||
| 260 | ); |
||
| 261 | } |
||
| 262 | |||
| 263 | $table = $schema->getTable('c_student_publication_comment'); |
||
| 264 | |||
| 265 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 266 | $this->addSql('ALTER TABLE c_student_publication_comment ADD resource_node_id INT DEFAULT NULL'); |
||
| 267 | $this->addSql( |
||
| 268 | 'ALTER TABLE c_student_publication_comment ADD CONSTRAINT FK_35C509F61BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 269 | ); |
||
| 270 | $this->addSql( |
||
| 271 | 'CREATE UNIQUE INDEX UNIQ_35C509F61BAD783F ON c_student_publication_comment (resource_node_id)' |
||
| 272 | ); |
||
| 273 | } |
||
| 274 | |||
| 275 | if ($table->hasIndex('course')) { |
||
| 276 | $this->addSql('DROP INDEX course ON c_student_publication_comment'); |
||
| 277 | } |
||
| 278 | |||
| 279 | $this->addSql('UPDATE c_student_publication_comment SET work_id = NULL WHERE work_id = 0'); |
||
| 280 | $this->addSql('UPDATE c_student_publication_comment SET user_id = NULL WHERE user_id = 0'); |
||
| 281 | |||
| 282 | $this->addSql('ALTER TABLE c_student_publication_comment CHANGE work_id work_id INT DEFAULT NULL'); |
||
| 283 | $this->addSql('ALTER TABLE c_student_publication_comment CHANGE user_id user_id INT DEFAULT NULL;'); |
||
| 284 | |||
| 285 | if (!$table->hasForeignKey('FK_35C509F6BB3453DB')) { |
||
| 286 | $this->addSql('ALTER TABLE c_student_publication_comment ADD CONSTRAINT FK_35C509F6BB3453DB FOREIGN KEY (work_id) REFERENCES c_student_publication (iid) ON DELETE CASCADE;'); |
||
| 287 | } |
||
| 288 | |||
| 289 | if (!$table->hasForeignKey('FK_35C509F6A76ED395')) { |
||
| 290 | $this->addSql('ALTER TABLE c_student_publication_comment ADD CONSTRAINT FK_35C509F6A76ED395 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;'); |
||
| 291 | } |
||
| 292 | |||
| 293 | if ($table->hasIndex('work')) { |
||
| 294 | $this->addSql('DROP INDEX work ON c_student_publication_comment;'); |
||
| 295 | } |
||
| 296 | |||
| 297 | if ($table->hasIndex('user')) { |
||
| 298 | $this->addSql('DROP INDEX user ON c_student_publication_comment;'); |
||
| 299 | } |
||
| 300 | |||
| 301 | if (!$table->hasIndex('IDX_35C509F6BB3453DB')) { |
||
| 302 | $this->addSql('CREATE INDEX IDX_35C509F6BB3453DB ON c_student_publication_comment (work_id);'); |
||
| 303 | } |
||
| 304 | |||
| 305 | if (!$table->hasIndex('IDX_35C509F6A76ED395')) { |
||
| 306 | $this->addSql('CREATE INDEX IDX_35C509F6A76ED395 ON c_student_publication_comment (user_id);'); |
||
| 307 | } |
||
| 308 | |||
| 309 | $table = $schema->getTable('c_calendar_event'); |
||
| 310 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 311 | $this->addSql('ALTER TABLE c_calendar_event ADD resource_node_id INT DEFAULT NULL'); |
||
| 312 | $this->addSql( |
||
| 313 | 'ALTER TABLE c_calendar_event ADD CONSTRAINT FK_A0622581EE3A445A FOREIGN KEY (parent_event_id) REFERENCES c_calendar_event (iid)' |
||
| 314 | ); |
||
| 315 | $this->addSql( |
||
| 316 | 'ALTER TABLE c_calendar_event ADD CONSTRAINT FK_A06225811BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 317 | ); |
||
| 318 | $this->addSql('CREATE INDEX IDX_A0622581EE3A445A ON c_calendar_event (parent_event_id)'); |
||
| 319 | $this->addSql('CREATE UNIQUE INDEX UNIQ_A06225811BAD783F ON c_calendar_event (resource_node_id)'); |
||
| 320 | } |
||
| 321 | |||
| 322 | if ($table->hasIndex('course')) { |
||
| 323 | $this->addSql('DROP INDEX course ON c_calendar_event'); |
||
| 324 | } |
||
| 325 | |||
| 326 | if ($table->hasIndex('session_id')) { |
||
| 327 | $this->addSql('DROP INDEX session_id ON c_calendar_event'); |
||
| 328 | } |
||
| 329 | |||
| 330 | $table = $schema->getTable('c_calendar_event_attachment'); |
||
| 331 | if ($table->hasIndex('course')) { |
||
| 332 | $this->addSql('DROP INDEX course ON c_calendar_event_attachment'); |
||
| 333 | } |
||
| 334 | |||
| 335 | $this->addSql('ALTER TABLE c_calendar_event_attachment CHANGE agenda_id agenda_id INT DEFAULT NULL'); |
||
| 336 | |||
| 337 | if (false === $table->hasColumn('resource_node_id')) { |
||
| 338 | $this->addSql('ALTER TABLE c_calendar_event_attachment ADD resource_node_id INT DEFAULT NULL'); |
||
| 339 | $this->addSql( |
||
| 340 | 'ALTER TABLE c_calendar_event_attachment ADD CONSTRAINT FK_DDD745A6EA67784A FOREIGN KEY (agenda_id) REFERENCES c_calendar_event (iid) ON DELETE CASCADE' |
||
| 341 | ); |
||
| 342 | $this->addSql( |
||
| 343 | 'ALTER TABLE c_calendar_event_attachment ADD CONSTRAINT FK_DDD745A61BAD783F FOREIGN KEY (resource_node_id) REFERENCES resource_node (id) ON DELETE CASCADE' |
||
| 344 | ); |
||
| 345 | $this->addSql('CREATE INDEX IDX_DDD745A6EA67784A ON c_calendar_event_attachment (agenda_id)'); |
||
| 346 | $this->addSql( |
||
| 347 | 'CREATE UNIQUE INDEX UNIQ_DDD745A61BAD783F ON c_calendar_event_attachment (resource_node_id)' |
||
| 348 | ); |
||
| 349 | } |
||
| 350 | |||
| 351 | $table = $schema->getTable('c_calendar_event_repeat'); |
||
| 352 | $this->addSql('ALTER TABLE c_calendar_event_repeat CHANGE cal_id cal_id INT DEFAULT NULL'); |
||
| 353 | if (false === $table->hasForeignKey('FK_86FD1CA87300D633')) { |
||
| 354 | $this->addSql( |
||
| 355 | 'ALTER TABLE c_calendar_event_repeat ADD CONSTRAINT FK_86FD1CA87300D633 FOREIGN KEY (cal_id) REFERENCES c_calendar_event (iid)' |
||
| 356 | ); |
||
| 357 | } |
||
| 358 | if (false === $table->hasIndex('IDX_86FD1CA87300D633')) { |
||
| 359 | $this->addSql('CREATE INDEX IDX_86FD1CA87300D633 ON c_calendar_event_repeat (cal_id)'); |
||
| 360 | } |
||
| 361 | |||
| 362 | if ($table->hasIndex('course')) { |
||
| 363 | $this->addSql('DROP INDEX course ON c_calendar_event_repeat'); |
||
| 364 | } |
||
| 365 | |||
| 366 | $table = $schema->getTable('c_calendar_event_repeat_not'); |
||
| 367 | |||
| 368 | if ($table->hasIndex('course')) { |
||
| 369 | $this->addSql('DROP INDEX course ON c_calendar_event_repeat_not'); |
||
| 370 | } |
||
| 371 | |||
| 372 | if (false === $table->hasForeignKey('FK_7D4436947300D633')) { |
||
| 373 | $this->addSql( |
||
| 374 | 'ALTER TABLE c_calendar_event_repeat_not ADD CONSTRAINT FK_7D4436947300D633 FOREIGN KEY (cal_id) REFERENCES c_calendar_event (iid)' |
||
| 375 | ); |
||
| 376 | } |
||
| 377 | |||
| 378 | $this->addSql('ALTER TABLE c_calendar_event_repeat_not CHANGE cal_id cal_id INT DEFAULT NULL'); |
||
| 379 | |||
| 380 | if (false === $table->hasIndex('IDX_7D4436947300D633')) { |
||
| 381 | $this->addSql('CREATE INDEX IDX_7D4436947300D633 ON c_calendar_event_repeat_not (cal_id)'); |
||
| 382 | } |
||
| 389 |