1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Data object containing the SQL and PHP code to migrate the database |
5
|
|
|
* up to version 1475694269. |
6
|
|
|
* Generated on 2016-10-05 22:04:29 |
7
|
|
|
*/ |
8
|
|
|
class PropelMigration_1475694269 |
|
|
|
|
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
|
|
|
CREATE TABLE `tasks` |
47
|
|
|
( |
48
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, |
49
|
|
|
`created_at` DATETIME, |
50
|
|
|
`updated_at` DATETIME, |
51
|
|
|
PRIMARY KEY (`id`) |
52
|
|
|
) ENGINE=InnoDB; |
53
|
|
|
|
54
|
|
|
CREATE TABLE `users` |
55
|
|
|
( |
56
|
|
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, |
57
|
|
|
`name` VARCHAR(255) NOT NULL, |
58
|
|
|
`email` VARCHAR(255) NOT NULL, |
59
|
|
|
`password` VARCHAR(255) NOT NULL, |
60
|
|
|
`remember_token` VARCHAR(100), |
61
|
|
|
`created_at` DATETIME, |
62
|
|
|
`updated_at` DATETIME, |
63
|
|
|
PRIMARY KEY (`id`), |
64
|
|
|
UNIQUE INDEX `users_email_unique` (`email`) |
65
|
|
|
) ENGINE=InnoDB; |
66
|
|
|
|
67
|
|
|
# This restores the fkey checks, after having unset them earlier |
68
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
69
|
|
|
', |
70
|
|
|
); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Get the SQL statements for the Down migration |
75
|
|
|
* |
76
|
|
|
* @return array list of the SQL strings to execute for the Down migration |
77
|
|
|
* the keys being the datasources |
78
|
|
|
*/ |
79
|
|
|
public function getDownSQL() |
80
|
|
|
{ |
81
|
|
|
return array ( |
82
|
|
|
'default' => ' |
83
|
|
|
# This is a fix for InnoDB in MySQL >= 4.1.x |
84
|
|
|
# It "suspends judgement" for fkey relationships until are tables are set. |
85
|
|
|
SET FOREIGN_KEY_CHECKS = 0; |
86
|
|
|
|
87
|
|
|
DROP TABLE IF EXISTS `tasks`; |
88
|
|
|
|
89
|
|
|
DROP TABLE IF EXISTS `users`; |
90
|
|
|
|
91
|
|
|
# This restores the fkey checks, after having unset them earlier |
92
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
93
|
|
|
', |
94
|
|
|
); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
} |
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.