Passed
Push — dependabot/npm_and_yarn/microm... ( f2f212...f35bf2 )
by
unknown
13:36 queued 05:58
created

Version20201217124010::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Migrations\Schema\V200;
8
9
use Chamilo\CoreBundle\Entity\Course;
10
use Chamilo\CoreBundle\Entity\ResourceLink;
11
use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
12
use Chamilo\CoreBundle\Repository\Node\CourseRepository;
13
use Chamilo\CoreBundle\Repository\SessionRepository;
14
use Chamilo\CourseBundle\Entity\CStudentPublication;
15
use Chamilo\CourseBundle\Entity\CStudentPublicationComment;
16
use Chamilo\CourseBundle\Entity\CStudentPublicationCorrection;
17
use Chamilo\CourseBundle\Repository\CGroupRepository;
18
use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository;
19
use Chamilo\CourseBundle\Repository\CStudentPublicationCorrectionRepository;
20
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository;
21
use Chamilo\Kernel;
22
use Doctrine\DBAL\Schema\Schema;
23
24
final class Version20201217124010 extends AbstractMigrationChamilo
25
{
26
    public function getDescription(): string
27
    {
28
        return 'Create and modify tables for peer assessment, autogroups, learning paths, group relations, and student publications.';
29
    }
30
31
    public function up(Schema $schema): void
32
    {
33
        $this->addSql("
34
            ALTER TABLE c_student_publication
35
            ADD IF NOT EXISTS student_delete_own_publication TINYINT(1) DEFAULT 0,
36
            ADD IF NOT EXISTS default_visibility TINYINT(1) DEFAULT 0,
37
            ADD IF NOT EXISTS extensions LONGTEXT DEFAULT NULL,
38
            ADD COLUMN group_category_id INT DEFAULT 0 NULL AFTER post_group_id
39
        ");
40
    }
41
42
    public function down(Schema $schema): void
43
    {
44
        $this->addSql("
45
            ALTER TABLE c_student_publication
46
            DROP IF EXISTS student_delete_own_publication,
47
            DROP IF EXISTS default_visibility,
48
            DROP IF EXISTS group_category_id,
49
            DROP IF EXISTS extensions
50
        ");
51
    }
52
}
53