1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Data object containing the SQL and PHP code to migrate the database |
5
|
|
|
* up to version 1475520687. |
6
|
|
|
* Generated on 2016-10-03 21:51:27 |
7
|
|
|
*/ |
8
|
|
|
class PropelMigration_1475520687 |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
public $comment = ''; |
11
|
|
|
|
12
|
|
|
public function preUp($manager) |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
// add the pre-migration code here |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
public function postUp($manager) |
|
|
|
|
18
|
|
|
{ |
19
|
|
|
// add the post-migration code here |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
public function preDown($manager) |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
// add the pre-migration code here |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function postDown($manager) |
|
|
|
|
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
|
|
|
'default' => ' |
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 `migrations`; |
47
|
|
|
|
48
|
|
|
DROP TABLE IF EXISTS `password_resets`; |
49
|
|
|
|
50
|
|
|
ALTER TABLE `tasks` |
51
|
|
|
|
52
|
|
|
DROP `name`, |
53
|
|
|
|
54
|
|
|
DROP `user_id`; |
55
|
|
|
|
56
|
|
|
# This restores the fkey checks, after having unset them earlier |
57
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
58
|
|
|
', |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get the SQL statements for the Down migration |
64
|
|
|
* |
65
|
|
|
* @return array list of the SQL strings to execute for the Down migration |
66
|
|
|
* the keys being the datasources |
67
|
|
|
*/ |
68
|
|
|
public function getDownSQL() |
69
|
|
|
{ |
70
|
|
|
return array ( |
71
|
|
|
'default' => ' |
72
|
|
|
# This is a fix for InnoDB in MySQL >= 4.1.x |
73
|
|
|
# It "suspends judgement" for fkey relationships until are tables are set. |
74
|
|
|
SET FOREIGN_KEY_CHECKS = 0; |
75
|
|
|
|
76
|
|
|
ALTER TABLE `tasks` |
77
|
|
|
|
78
|
|
|
ADD `name` VARCHAR(50) AFTER `updated_at`, |
79
|
|
|
|
80
|
|
|
ADD `user_id` INTEGER AFTER `name`; |
81
|
|
|
|
82
|
|
|
CREATE TABLE `migrations` |
83
|
|
|
( |
84
|
|
|
`migration` VARCHAR(255) NOT NULL, |
85
|
|
|
`batch` INTEGER NOT NULL |
86
|
|
|
) ENGINE=InnoDB; |
87
|
|
|
|
88
|
|
|
CREATE TABLE `password_resets` |
89
|
|
|
( |
90
|
|
|
`email` VARCHAR(255) NOT NULL, |
91
|
|
|
`token` VARCHAR(255) NOT NULL, |
92
|
|
|
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, |
93
|
|
|
INDEX `password_resets_email_index` (`email`), |
94
|
|
|
INDEX `password_resets_token_index` (`token`) |
95
|
|
|
) ENGINE=InnoDB; |
96
|
|
|
|
97
|
|
|
# This restores the fkey checks, after having unset them earlier |
98
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
99
|
|
|
', |
100
|
|
|
); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.