Conditions | 48 |
Paths | 0 |
Total Lines | 245 |
Code Lines | 148 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
316 | public function down(Schema $schema): void |
||
317 | { |
||
318 | $table = $schema->getTable('skill_level_profile'); |
||
319 | if ($table->hasColumn('title')) { |
||
320 | $this->addSql('ALTER TABLE skill_level_profile CHANGE title name VARCHAR(255) NOT NULL'); |
||
321 | } |
||
322 | |||
323 | $table = $schema->getTable('skill_level'); |
||
324 | if ($table->hasColumn('title')) { |
||
325 | $this->addSql('ALTER TABLE skill_level CHANGE title name VARCHAR(255) NOT NULL'); |
||
326 | } |
||
327 | |||
328 | $table = $schema->getTable('session_category'); |
||
329 | if ($table->hasColumn('title')) { |
||
330 | $this->addSql('ALTER TABLE session_category CHANGE title name VARCHAR(100) NOT NULL'); |
||
331 | } |
||
332 | |||
333 | $table = $schema->getTable('ticket_status'); |
||
334 | if ($table->hasColumn('title')) { |
||
335 | $this->addSql('ALTER TABLE ticket_status CHANGE title name VARCHAR(255) NOT NULL'); |
||
336 | } |
||
337 | |||
338 | $table = $schema->getTable('skill_profile'); |
||
339 | if ($table->hasColumn('title')) { |
||
340 | $this->addSql('ALTER TABLE skill_profile CHANGE title name VARCHAR(255) NOT NULL'); |
||
341 | } |
||
342 | |||
343 | $table = $schema->getTable('session'); |
||
344 | if ($table->hasColumn('title')) { |
||
345 | $this->addSql('DROP INDEX title ON session'); |
||
346 | $this->addSql('ALTER TABLE session CHANGE title name VARCHAR(150) NOT NULL'); |
||
347 | $this->addSql('CREATE UNIQUE INDEX name ON session (name)'); |
||
348 | } |
||
349 | |||
350 | $table = $schema->getTable('ticket_category'); |
||
351 | if ($table->hasColumn('title')) { |
||
352 | $this->addSql('ALTER TABLE ticket_category CHANGE title name VARCHAR(255) NOT NULL'); |
||
353 | } |
||
354 | |||
355 | $table = $schema->getTable('sequence'); |
||
356 | if ($table->hasColumn('title')) { |
||
357 | $this->addSql('ALTER TABLE sequence CHANGE title name VARCHAR(255) NOT NULL'); |
||
358 | } |
||
359 | |||
360 | $table = $schema->getTable('promotion'); |
||
361 | if ($table->hasColumn('title')) { |
||
362 | $this->addSql('ALTER TABLE promotion CHANGE title name VARCHAR(255) NOT NULL'); |
||
363 | } |
||
364 | |||
365 | $table = $schema->getTable('mail_template'); |
||
366 | if ($table->hasColumn('title')) { |
||
367 | $this->addSql('ALTER TABLE mail_template CHANGE title name VARCHAR(255) NOT NULL'); |
||
368 | } |
||
369 | |||
370 | $table = $schema->getTable('sequence_type_entity'); |
||
371 | if ($table->hasColumn('title')) { |
||
372 | $this->addSql('ALTER TABLE sequence_type_entity CHANGE title name VARCHAR(255) NOT NULL'); |
||
373 | } |
||
374 | |||
375 | $table = $schema->getTable('ticket_priority'); |
||
376 | if ($table->hasColumn('title')) { |
||
377 | $this->addSql('ALTER TABLE ticket_priority CHANGE title name VARCHAR(255) NOT NULL'); |
||
378 | } |
||
379 | |||
380 | $table = $schema->getTable('specific_field'); |
||
381 | if ($table->hasColumn('title')) { |
||
382 | $this->addSql('ALTER TABLE specific_field CHANGE title name VARCHAR(255) NOT NULL'); |
||
383 | } |
||
384 | |||
385 | $table = $schema->getTable('sequence_variable'); |
||
386 | if ($table->hasColumn('title')) { |
||
387 | $this->addSql('ALTER TABLE sequence_variable CHANGE title name VARCHAR(255) NOT NULL'); |
||
388 | } |
||
389 | |||
390 | $table = $schema->getTable('skill'); |
||
391 | if ($table->hasColumn('title')) { |
||
392 | $this->addSql('ALTER TABLE skill CHANGE title name VARCHAR(255) NOT NULL'); |
||
393 | } |
||
394 | |||
395 | $table = $schema->getTable('ticket_project'); |
||
396 | if ($table->hasColumn('title')) { |
||
397 | $this->addSql('ALTER TABLE ticket_project CHANGE title name VARCHAR(255) NOT NULL'); |
||
398 | } |
||
399 | |||
400 | $table = $schema->getTable('sequence_row_entity'); |
||
401 | if ($table->hasColumn('title')) { |
||
402 | $this->addSql('ALTER TABLE sequence_row_entity CHANGE title name VARCHAR(255) NOT NULL'); |
||
403 | } |
||
404 | |||
405 | $table = $schema->getTable('usergroup'); |
||
406 | if ($table->hasColumn('title')) { |
||
407 | $this->addSql('ALTER TABLE usergroup CHANGE title name VARCHAR(255) NOT NULL'); |
||
408 | } |
||
409 | |||
410 | $table = $schema->getTable('gradebook_evaluation'); |
||
411 | if ($table->hasColumn('title')) { |
||
412 | $this->addSql('ALTER TABLE gradebook_evaluation CHANGE title name LONGTEXT NOT NULL'); |
||
413 | } |
||
414 | |||
415 | $table = $schema->getTable('gradebook_category'); |
||
416 | if ($table->hasColumn('title')) { |
||
417 | $this->addSql('ALTER TABLE gradebook_category CHANGE title name LONGTEXT NOT NULL'); |
||
418 | } |
||
419 | |||
420 | $table = $schema->getTable('gradebook_linkeval_log'); |
||
421 | if ($table->hasColumn('title')) { |
||
422 | $this->addSql('ALTER TABLE gradebook_linkeval_log CHANGE title name LONGTEXT NOT NULL'); |
||
423 | } |
||
424 | |||
425 | $table = $schema->getTable('grade_model'); |
||
426 | if ($table->hasColumn('title')) { |
||
427 | $this->addSql('ALTER TABLE grade_model CHANGE title name VARCHAR(255) NOT NULL'); |
||
428 | } |
||
429 | |||
430 | $table = $schema->getTable('course_type'); |
||
431 | if ($table->hasColumn('title')) { |
||
432 | $this->addSql('ALTER TABLE course_type CHANGE title name VARCHAR(50) NOT NULL'); |
||
433 | } |
||
434 | |||
435 | $table = $schema->getTable('course_module'); |
||
436 | if ($table->hasColumn('title')) { |
||
437 | $this->addSql('ALTER TABLE course_module CHANGE title name VARCHAR(255) NOT NULL'); |
||
438 | } |
||
439 | |||
440 | $table = $schema->getTable('course_category'); |
||
441 | if ($table->hasColumn('title')) { |
||
442 | $this->addSql('ALTER TABLE course_category CHANGE title name LONGTEXT NOT NULL'); |
||
443 | } |
||
444 | |||
445 | $table = $schema->getTable('class_item'); |
||
446 | if ($table->hasColumn('title')) { |
||
447 | $this->addSql('ALTER TABLE class_item CHANGE title name LONGTEXT NOT NULL'); |
||
448 | } |
||
449 | |||
450 | $table = $schema->getTable('chat_video'); |
||
451 | if ($table->hasColumn('title')) { |
||
452 | $this->addSql( |
||
453 | 'DROP INDEX idx_chat_video_title ON chat_video' |
||
454 | ); |
||
455 | $this->addSql( |
||
456 | 'ALTER TABLE chat_video CHANGE title room_name VARCHAR(255) NOT NULL' |
||
457 | ); |
||
458 | $this->addSql( |
||
459 | 'CREATE INDEX idx_chat_video_room_name ON chat_video (room_name)' |
||
460 | ); |
||
461 | } |
||
462 | |||
463 | $table = $schema->getTable('career'); |
||
464 | if ($table->hasColumn('title')) { |
||
465 | $this->addSql('ALTER TABLE career CHANGE title name VARCHAR(255) NOT NULL'); |
||
466 | } |
||
467 | |||
468 | $table = $schema->getTable('c_tool'); |
||
469 | if ($table->hasColumn('title')) { |
||
470 | $this->addSql('ALTER TABLE c_tool CHANGE title name LONGTEXT NOT NULL'); |
||
471 | } |
||
472 | |||
473 | $table = $schema->getTable('c_survey_group'); |
||
474 | if ($table->hasColumn('title')) { |
||
475 | $this->addSql('ALTER TABLE c_survey_group CHANGE title name VARCHAR(20) NOT NULL'); |
||
476 | } |
||
477 | |||
478 | $table = $schema->getTable('c_quiz_question_option'); |
||
479 | if ($table->hasColumn('title')) { |
||
480 | $this->addSql('ALTER TABLE c_quiz_question_option CHANGE title name VARCHAR(255) NOT NULL'); |
||
481 | } |
||
482 | |||
483 | $table = $schema->getTable('c_online_link'); |
||
484 | if ($table->hasColumn('title')) { |
||
485 | $this->addSql('ALTER TABLE c_online_link CHANGE title name VARCHAR(50) NOT NULL'); |
||
486 | } |
||
487 | |||
488 | $table = $schema->getTable('c_lp_category'); |
||
489 | if ($table->hasColumn('title')) { |
||
490 | $this->addSql('ALTER TABLE c_lp_category CHANGE title name LONGTEXT NOT NULL'); |
||
491 | } |
||
492 | |||
493 | $table = $schema->getTable('c_lp'); |
||
494 | if ($table->hasColumn('title')) { |
||
495 | $this->addSql('ALTER TABLE c_lp CHANGE title name VARCHAR(255) NOT NULL'); |
||
496 | } |
||
497 | |||
498 | $table = $schema->getTable('c_link_category'); |
||
499 | if ($table->hasColumn('title')) { |
||
500 | $this->addSql('ALTER TABLE c_link_category CHANGE title category_title VARCHAR(255) NOT NULL'); |
||
501 | } |
||
502 | |||
503 | $table = $schema->getTable('c_group_info'); |
||
504 | if ($table->hasColumn('title')) { |
||
505 | $this->addSql('ALTER TABLE c_group_info CHANGE title name VARCHAR(100) NOT NULL'); |
||
506 | } |
||
507 | |||
508 | $table = $schema->getTable('c_glossary'); |
||
509 | if ($table->hasColumn('title')) { |
||
510 | $this->addSql('ALTER TABLE c_glossary CHANGE title name LONGTEXT NOT NULL'); |
||
511 | } |
||
512 | |||
513 | $table = $schema->getTable('c_forum_thread'); |
||
514 | if ($table->hasColumn('title')) { |
||
515 | $this->addSql('ALTER TABLE c_forum_thread CHANGE title thread_title VARCHAR(255) NOT NULL'); |
||
516 | } |
||
517 | |||
518 | $table = $schema->getTable('c_forum_post'); |
||
519 | if ($table->hasColumn('title')) { |
||
520 | $this->addSql('ALTER TABLE c_forum_post CHANGE title post_title VARCHAR(250) NOT NULL'); |
||
521 | } |
||
522 | |||
523 | $table = $schema->getTable('c_forum_forum'); |
||
524 | if ($table->hasColumn('title')) { |
||
525 | $this->addSql('ALTER TABLE c_forum_forum CHANGE title forum_title VARCHAR(255) NOT NULL'); |
||
526 | } |
||
527 | |||
528 | $table = $schema->getTable('c_forum_category'); |
||
529 | if ($table->hasColumn('title')) { |
||
530 | $this->addSql('ALTER TABLE c_forum_category CHANGE title cat_title VARCHAR(255) NOT NULL'); |
||
531 | } |
||
532 | |||
533 | $table = $schema->getTable('c_exercise_category'); |
||
534 | if ($table->hasColumn('title')) { |
||
535 | $this->addSql('ALTER TABLE c_exercise_category CHANGE title name VARCHAR(255) NOT NULL'); |
||
536 | } |
||
537 | |||
538 | $table = $schema->getTable('c_dropbox_category'); |
||
539 | if ($table->hasColumn('title')) { |
||
540 | $this->addSql('ALTER TABLE c_dropbox_category CHANGE title cat_name LONGTEXT NOT NULL'); |
||
541 | } |
||
542 | |||
543 | $table = $schema->getTable('c_blog'); |
||
544 | if ($table->hasColumn('title')) { |
||
545 | $this->addSql('ALTER TABLE c_blog CHANGE title blog_name LONGTEXT NOT NULL'); |
||
546 | } |
||
547 | |||
548 | $table = $schema->getTable('c_attendance'); |
||
549 | if ($table->hasColumn('title')) { |
||
550 | $this->addSql('ALTER TABLE c_attendance CHANGE title name LONGTEXT NOT NULL'); |
||
551 | } |
||
552 | |||
553 | $table = $schema->getTable('branch_sync'); |
||
554 | if ($table->hasColumn('title')) { |
||
555 | $this->addSql('ALTER TABLE branch_sync CHANGE title branch_name VARCHAR(250) NOT NULL'); |
||
556 | } |
||
557 | |||
558 | $table = $schema->getTable('block'); |
||
559 | if ($table->hasColumn('title')) { |
||
560 | $this->addSql('ALTER TABLE block CHANGE title name varchar(255) COLLATE "utf8_unicode_ci" NULL'); |
||
561 | } |
||
564 |