Version20160617163830::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 39
Code Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 25
nc 1
nop 1
dl 0
loc 39
rs 9.52
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright 2016 SURFnet bv
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
0 ignored issues
show
Coding Style introduced by
Missing @link tag in file comment
Loading history...
18
19
namespace Surfnet\Migrations;
20
21
use Doctrine\DBAL\Schema\Schema;
22
use Doctrine\Migrations\AbstractMigration;
23
24
/**
25
 * Auto-generated Migration: Please modify to your needs!
26
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
27
class Version20160617163830 extends AbstractMigration
28
{
29
    /**
30
     * @param Schema $schema
31
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
32
    public function up(Schema $schema): void
33
    {
34
        // this up() migration is auto-generated, please modify it to your needs
35
        $this->abortIf(
36
            $this->connection->getDatabasePlatform()->getName() != 'mysql',
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Platforms\...ractPlatform::getName() has been deprecated: Identify platforms by their class. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

36
            /** @scrutinizer ignore-deprecated */ $this->connection->getDatabasePlatform()->getName() != 'mysql',

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
37
            'Migration can only be executed safely on \'mysql\'.',
38
        );
39
40
        $this->addSql(
41
            'CREATE TABLE ra_location (ra_location_id VARCHAR(36) NOT NULL, institution VARCHAR(255) NOT NULL, ra_location_name VARCHAR(255) NOT NULL, location LONGTEXT NOT NULL, contact_information LONGTEXT NOT NULL, INDEX idx_ra_location_institution (institution), PRIMARY KEY(ra_location_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB',
42
        );
43
        $this->addSql(
44
            'ALTER TABLE audit_log CHANGE actor_institution actor_institution VARCHAR(255) DEFAULT NULL, CHANGE identity_institution identity_institution VARCHAR(255) NOT NULL, CHANGE recorded_on recorded_on DATETIME NOT NULL, CHANGE actor_common_name actor_common_name VARCHAR(255) DEFAULT NULL',
45
        );
46
        $this->addSql(
47
            'ALTER TABLE identity CHANGE name_id name_id VARCHAR(255) NOT NULL, CHANGE institution institution VARCHAR(255) NOT NULL, CHANGE email email VARCHAR(255) NOT NULL, CHANGE common_name common_name VARCHAR(255) NOT NULL, CHANGE preferred_locale preferred_locale VARCHAR(255) NOT NULL',
48
        );
49
        $this->addSql('ALTER TABLE institution_listing CHANGE institution institution VARCHAR(255) NOT NULL');
50
        $this->addSql(
51
            'ALTER TABLE ra_candidate CHANGE institution institution VARCHAR(255) NOT NULL, CHANGE common_name common_name VARCHAR(255) NOT NULL, CHANGE email email VARCHAR(255) NOT NULL, CHANGE name_id name_id VARCHAR(255) NOT NULL',
52
        );
53
        $this->addSql(
54
            'ALTER TABLE ra_listing CHANGE institution institution VARCHAR(255) NOT NULL, CHANGE common_name common_name VARCHAR(255) NOT NULL, CHANGE email email VARCHAR(255) NOT NULL, CHANGE role role VARCHAR(20) NOT NULL, CHANGE location location LONGTEXT DEFAULT NULL, CHANGE contact_information contact_information LONGTEXT DEFAULT NULL',
55
        );
56
        $this->addSql(
57
            'ALTER TABLE ra_second_factor CHANGE institution institution VARCHAR(255) NOT NULL, CHANGE name name VARCHAR(255) NOT NULL, CHANGE email email VARCHAR(255) NOT NULL, CHANGE status status INT NOT NULL, CHANGE document_number document_number VARCHAR(255) NOT NULL',
58
        );
59
        $this->addSql(
60
            'ALTER TABLE second_factor_revocation CHANGE institution institution VARCHAR(255) NOT NULL, CHANGE recorded_on recorded_on DATETIME NOT NULL',
61
        );
62
        $this->addSql('ALTER TABLE sraa CHANGE name_id name_id VARCHAR(200) NOT NULL');
63
        $this->addSql(
64
            'ALTER TABLE unverified_second_factor CHANGE identity_id identity_id VARCHAR(36) NOT NULL, CHANGE verification_nonce_valid_until verification_nonce_valid_until DATETIME NOT NULL',
65
        );
66
        $this->addSql('ALTER TABLE vetted_second_factor CHANGE identity_id identity_id VARCHAR(36) NOT NULL');
67
        $this->addSql('ALTER TABLE whitelist_entry CHANGE institution institution VARCHAR(255) NOT NULL');
68
    }
69
70
    /**
71
     * @param Schema $schema
72
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
73
    public function down(Schema $schema): void
74
    {
75
        // this down() migration is auto-generated, please modify it to your needs
76
        $this->abortIf(
77
            $this->connection->getDatabasePlatform()->getName() != 'mysql',
0 ignored issues
show
Deprecated Code introduced by
The function Doctrine\DBAL\Platforms\...ractPlatform::getName() has been deprecated: Identify platforms by their class. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

77
            /** @scrutinizer ignore-deprecated */ $this->connection->getDatabasePlatform()->getName() != 'mysql',

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
78
            'Migration can only be executed safely on \'mysql\'.',
79
        );
80
81
        $this->addSql('DROP TABLE ra_location');
82
        $this->addSql(
83
            'ALTER TABLE audit_log CHANGE actor_common_name actor_common_name VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, CHANGE actor_institution actor_institution VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, CHANGE identity_institution identity_institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE recorded_on recorded_on DATETIME NOT NULL',
84
        );
85
        $this->addSql(
86
            'ALTER TABLE identity CHANGE name_id name_id VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE common_name common_name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE email email VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE preferred_locale preferred_locale VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci',
87
        );
88
        $this->addSql(
89
            'ALTER TABLE institution_listing CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci',
90
        );
91
        $this->addSql(
92
            'ALTER TABLE ra_candidate CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE name_id name_id VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE common_name common_name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE email email VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci',
93
        );
94
        $this->addSql(
95
            'ALTER TABLE ra_listing CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE common_name common_name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE email email VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE role role VARCHAR(20) NOT NULL COLLATE utf8_unicode_ci, CHANGE location location LONGTEXT DEFAULT NULL COLLATE utf8_unicode_ci, CHANGE contact_information contact_information LONGTEXT DEFAULT NULL COLLATE utf8_unicode_ci',
96
        );
97
        $this->addSql(
98
            'ALTER TABLE ra_second_factor CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE name name VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE email email VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE document_number document_number VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, CHANGE status status INT NOT NULL',
99
        );
100
        $this->addSql(
101
            'ALTER TABLE second_factor_revocation CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci, CHANGE recorded_on recorded_on DATETIME NOT NULL',
102
        );
103
        $this->addSql('ALTER TABLE sraa CHANGE name_id name_id VARCHAR(200) NOT NULL COLLATE utf8_unicode_ci');
104
        $this->addSql(
105
            'ALTER TABLE unverified_second_factor CHANGE identity_id identity_id VARCHAR(36) DEFAULT NULL COLLATE utf8_unicode_ci, CHANGE verification_nonce_valid_until verification_nonce_valid_until DATETIME NOT NULL',
106
        );
107
        $this->addSql(
108
            'ALTER TABLE vetted_second_factor CHANGE identity_id identity_id VARCHAR(36) DEFAULT NULL COLLATE utf8_unicode_ci',
109
        );
110
        $this->addSql(
111
            'ALTER TABLE whitelist_entry CHANGE institution institution VARCHAR(255) NOT NULL COLLATE utf8_unicode_ci',
112
        );
113
    }
114
}
115