Completed
Push — master ( 6565fb...b207da )
by Thomas
10:01
created

PropelMigration_1463151118::getUpSQL()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 71
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 71
rs 9.1369
cc 1
eloc 3
nc 1
nop 0

How to fix   Long Method   

Long Method

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:

1
<?php
2
3
/**
4
 * Data object containing the SQL and PHP code to migrate the database
5
 * up to version 1463151118.
6
 * Generated on 2016-05-13 16:51:58 by thomas
7
 */
8
class PropelMigration_1463151118
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
Coding Style introduced by
This class is not in CamelCase format.

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
9
{
10
    public $comment = '';
11
12
    public function preUp($manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
14
        // add the pre-migration code here
15
    }
16
17
    public function postUp($manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        // add the post-migration code here
20
    }
21
22
    public function preDown($manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
23
    {
24
        // add the pre-migration code here
25
    }
26
27
    public function postDown($manager)
0 ignored issues
show
Unused Code introduced by
The parameter $manager is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
28
    {
29
        // add the post-migration code here
30
    }
31
32
    /**
33
     * Get the SQL statements for the Up migration
34
     *
35
     * @return array list of the SQL strings to execute for the Up migration
36
     *               the keys being the datasources
37
     */
38
    public function getUpSQL()
39
    {
40
        return array (
41
  'keeko' => '
42
# This is a fix for InnoDB in MySQL >= 4.1.x
43
# It "suspends judgement" for fkey relationships until are tables are set.
44
SET FOREIGN_KEY_CHECKS = 0;
45
46
DROP TABLE IF EXISTS `kk_auth`;
47
48
ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_application`;
49
50
ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_localization`;
51
52
ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_application`
53
    FOREIGN KEY (`application_id`)
54
    REFERENCES `kk_application` (`id`)
55
    ON DELETE RESTRICT;
56
57
ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_localization`
58
    FOREIGN KEY (`localization_id`)
59
    REFERENCES `kk_localization` (`id`)
60
    ON DELETE RESTRICT;
61
62
ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_action`;
63
64
ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_group`;
65
66
ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_action`
67
    FOREIGN KEY (`action_id`)
68
    REFERENCES `kk_action` (`id`)
69
    ON DELETE RESTRICT;
70
71
ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_group`
72
    FOREIGN KEY (`group_id`)
73
    REFERENCES `kk_group` (`id`)
74
    ON DELETE RESTRICT;
75
76
ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_localization`;
77
78
ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_variant`;
79
80
ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_localization`
81
    FOREIGN KEY (`localization_id`)
82
    REFERENCES `kk_localization` (`id`)
83
    ON DELETE RESTRICT;
84
85
ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_variant`
86
    FOREIGN KEY (`variant_id`)
87
    REFERENCES `kk_language_variant` (`id`)
88
    ON DELETE RESTRICT;
89
90
ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_group`;
91
92
ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_user`;
93
94
ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_group`
95
    FOREIGN KEY (`group_id`)
96
    REFERENCES `kk_group` (`id`)
97
    ON DELETE RESTRICT;
98
99
ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_user`
100
    FOREIGN KEY (`user_id`)
101
    REFERENCES `kk_user` (`id`)
102
    ON DELETE RESTRICT;
103
104
# This restores the fkey checks, after having unset them earlier
105
SET FOREIGN_KEY_CHECKS = 1;
106
',
107
);
108
    }
109
110
    /**
111
     * Get the SQL statements for the Down migration
112
     *
113
     * @return array list of the SQL strings to execute for the Down migration
114
     *               the keys being the datasources
115
     */
116
    public function getDownSQL()
117
    {
118
        return array (
119
  'keeko' => '
120
# This is a fix for InnoDB in MySQL >= 4.1.x
121
# It "suspends judgement" for fkey relationships until are tables are set.
122
SET FOREIGN_KEY_CHECKS = 0;
123
124
ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_application`;
125
126
ALTER TABLE `kk_application_uri` DROP FOREIGN KEY `application_uri_fk_localization`;
127
128
ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_application`
129
    FOREIGN KEY (`application_id`)
130
    REFERENCES `kk_application` (`id`);
131
132
ALTER TABLE `kk_application_uri` ADD CONSTRAINT `application_uri_fk_localization`
133
    FOREIGN KEY (`localization_id`)
134
    REFERENCES `kk_localization` (`id`);
135
136
ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_action`;
137
138
ALTER TABLE `kk_group_action` DROP FOREIGN KEY `group_action_fk_group`;
139
140
ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_action`
141
    FOREIGN KEY (`action_id`)
142
    REFERENCES `kk_action` (`id`);
143
144
ALTER TABLE `kk_group_action` ADD CONSTRAINT `group_action_fk_group`
145
    FOREIGN KEY (`group_id`)
146
    REFERENCES `kk_group` (`id`);
147
148
ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_localization`;
149
150
ALTER TABLE `kk_localization_variant` DROP FOREIGN KEY `localization_variant_fk_variant`;
151
152
ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_localization`
153
    FOREIGN KEY (`localization_id`)
154
    REFERENCES `kk_localization` (`id`);
155
156
ALTER TABLE `kk_localization_variant` ADD CONSTRAINT `localization_variant_fk_variant`
157
    FOREIGN KEY (`variant_id`)
158
    REFERENCES `kk_language_variant` (`id`);
159
160
ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_group`;
161
162
ALTER TABLE `kk_user_group` DROP FOREIGN KEY `user_group_fk_user`;
163
164
ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_group`
165
    FOREIGN KEY (`group_id`)
166
    REFERENCES `kk_group` (`id`);
167
168
ALTER TABLE `kk_user_group` ADD CONSTRAINT `user_group_fk_user`
169
    FOREIGN KEY (`user_id`)
170
    REFERENCES `kk_user` (`id`);
171
172
CREATE TABLE `kk_auth`
173
(
174
    `token` VARCHAR(32) NOT NULL,
175
    `user_id` INTEGER(10) NOT NULL,
176
    `created_at` DATETIME,
177
    `updated_at` DATETIME,
178
    PRIMARY KEY (`token`),
179
    INDEX `auth_fi_user` (`user_id`),
180
    CONSTRAINT `auth_fk_user`
181
        FOREIGN KEY (`user_id`)
182
        REFERENCES `kk_user` (`id`)
183
) ENGINE=InnoDB;
184
185
# This restores the fkey checks, after having unset them earlier
186
SET FOREIGN_KEY_CHECKS = 1;
187
',
188
);
189
    }
190
191
}