1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Data object containing the SQL and PHP code to migrate the database |
5
|
|
|
* up to version 1455269809. |
6
|
|
|
* Generated on 2016-02-12 09:36:49 by vagrant |
7
|
|
|
*/ |
8
|
|
|
class PropelMigration_1455269809 |
|
|
|
|
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
|
|
|
'tvheadend_status_manager' => ' |
42
|
|
|
PRAGMA foreign_keys = OFF; |
43
|
|
|
|
44
|
|
|
CREATE TEMPORARY TABLE [subscription__temp__56bda7b15e2bd] AS SELECT [id],[instance_name],[input_uuid],[user_id],[channel_id],[subscription_id],[started],[stopped],[title],[service] FROM [subscription]; |
45
|
|
|
DROP TABLE [subscription]; |
46
|
|
|
|
47
|
|
|
CREATE TABLE [subscription] |
48
|
|
|
( |
49
|
|
|
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
50
|
|
|
[instance_name] VARCHAR(255) NOT NULL, |
51
|
|
|
[input_uuid] VARCHAR(255) NOT NULL, |
52
|
|
|
[user_id] INTEGER, |
53
|
|
|
[channel_id] INTEGER NOT NULL, |
54
|
|
|
[subscription_id] INTEGER NOT NULL, |
55
|
|
|
[started] TIMESTAMP NOT NULL, |
56
|
|
|
[stopped] TIMESTAMP, |
57
|
|
|
[title] VARCHAR(255) NOT NULL, |
58
|
|
|
[service] VARCHAR(255) NOT NULL, |
59
|
|
|
UNIQUE ([id]), |
60
|
|
|
FOREIGN KEY ([instance_name]) REFERENCES [instance] ([name]), |
61
|
|
|
FOREIGN KEY ([input_uuid]) REFERENCES [input] ([uuid]), |
62
|
|
|
FOREIGN KEY ([user_id]) REFERENCES [user] ([id]), |
63
|
|
|
FOREIGN KEY ([channel_id]) REFERENCES [channel] ([id]) |
64
|
|
|
); |
65
|
|
|
|
66
|
|
|
INSERT INTO [subscription] (input_uuid, id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service) SELECT input_uuid, id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM [subscription__temp__56bda7b15e2bd]; |
67
|
|
|
DROP TABLE [subscription__temp__56bda7b15e2bd]; |
68
|
|
|
|
69
|
|
|
PRAGMA foreign_keys = ON; |
70
|
|
|
', |
71
|
|
|
); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Get the SQL statements for the Down migration |
76
|
|
|
* |
77
|
|
|
* @return array list of the SQL strings to execute for the Down migration |
78
|
|
|
* the keys being the datasources |
79
|
|
|
*/ |
80
|
|
|
public function getDownSQL() |
81
|
|
|
{ |
82
|
|
|
return array ( |
83
|
|
|
'tvheadend_status_manager' => ' |
84
|
|
|
PRAGMA foreign_keys = OFF; |
85
|
|
|
|
86
|
|
|
CREATE TEMPORARY TABLE [subscription__temp__56bda7b15e8c9] AS SELECT [id],[instance_name],[input_uuid],[user_id],[channel_id],[subscription_id],[started],[stopped],[title],[service] FROM [subscription]; |
87
|
|
|
DROP TABLE [subscription]; |
88
|
|
|
|
89
|
|
|
CREATE TABLE [subscription] |
90
|
|
|
( |
91
|
|
|
[id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, |
92
|
|
|
[instance_name] VARCHAR(255) NOT NULL, |
93
|
|
|
[input_uuid] VARCHAR(255), |
94
|
|
|
[user_id] INTEGER, |
95
|
|
|
[channel_id] INTEGER NOT NULL, |
96
|
|
|
[subscription_id] INTEGER NOT NULL, |
97
|
|
|
[started] TIMESTAMP NOT NULL, |
98
|
|
|
[stopped] TIMESTAMP, |
99
|
|
|
[title] VARCHAR(255) NOT NULL, |
100
|
|
|
[service] VARCHAR(255) NOT NULL, |
101
|
|
|
UNIQUE ([id]), |
102
|
|
|
FOREIGN KEY ([channel_id]) REFERENCES [channel] ([id]), |
103
|
|
|
FOREIGN KEY ([user_id]) REFERENCES [user] ([id]), |
104
|
|
|
FOREIGN KEY ([input_uuid]) REFERENCES [input] ([uuid]), |
105
|
|
|
FOREIGN KEY ([instance_name]) REFERENCES [instance] ([name]) |
106
|
|
|
); |
107
|
|
|
|
108
|
|
|
INSERT INTO [subscription] (input_uuid, id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service) SELECT input_uuid, id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM [subscription__temp__56bda7b15e8c9]; |
109
|
|
|
DROP TABLE [subscription__temp__56bda7b15e8c9]; |
110
|
|
|
|
111
|
|
|
PRAGMA foreign_keys = ON; |
112
|
|
|
', |
113
|
|
|
); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
} |
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.