1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Data object containing the SQL and PHP code to migrate the database |
5
|
|
|
* up to version 1475647555. |
6
|
|
|
* Generated on 2016-10-05 09:05:55 |
7
|
|
|
*/ |
8
|
|
|
class PropelMigration_1475647555 |
|
|
|
|
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
|
|
|
CREATE TABLE `selfprice` |
68
|
|
|
( |
69
|
|
|
`id` INTEGER NOT NULL AUTO_INCREMENT, |
70
|
|
|
`name` VARCHAR(50), |
71
|
|
|
`datecreate` DATETIME, |
72
|
|
|
`desc` VARCHAR(255), |
73
|
|
|
PRIMARY KEY (`id`) |
74
|
|
|
) ENGINE=InnoDB; |
75
|
|
|
|
76
|
|
|
# This restores the fkey checks, after having unset them earlier |
77
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
78
|
|
|
', |
79
|
|
|
); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get the SQL statements for the Down migration |
84
|
|
|
* |
85
|
|
|
* @return array list of the SQL strings to execute for the Down migration |
86
|
|
|
* the keys being the datasources |
87
|
|
|
*/ |
88
|
|
|
public function getDownSQL() |
89
|
|
|
{ |
90
|
|
|
return array ( |
91
|
|
|
'default' => ' |
92
|
|
|
# This is a fix for InnoDB in MySQL >= 4.1.x |
93
|
|
|
# It "suspends judgement" for fkey relationships until are tables are set. |
94
|
|
|
SET FOREIGN_KEY_CHECKS = 0; |
95
|
|
|
|
96
|
|
|
DROP TABLE IF EXISTS `tasks`; |
97
|
|
|
|
98
|
|
|
DROP TABLE IF EXISTS `users`; |
99
|
|
|
|
100
|
|
|
DROP TABLE IF EXISTS `selfprice`; |
101
|
|
|
|
102
|
|
|
# This restores the fkey checks, after having unset them earlier |
103
|
|
|
SET FOREIGN_KEY_CHECKS = 1; |
104
|
|
|
', |
105
|
|
|
); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
} |
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.