|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Data object containing the SQL and PHP code to migrate the database |
|
5
|
|
|
* up to version 1455269455. |
|
6
|
|
|
* Generated on 2016-02-12 09:30:55 by vagrant |
|
7
|
|
|
*/ |
|
8
|
|
|
class PropelMigration_1455269455 |
|
|
|
|
|
|
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__56bda64f12586] AS SELECT [id],[instance_name],[user_id],[channel_id],[subscription_id],[started],[stopped],[title],[service],[input_id] 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), |
|
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] (id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service) SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM [subscription__temp__56bda64f12586]; |
|
67
|
|
|
DROP TABLE [subscription__temp__56bda64f12586]; |
|
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__56bda64f128f1] 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
|
|
|
[user_id] INTEGER, |
|
94
|
|
|
[channel_id] INTEGER NOT NULL, |
|
95
|
|
|
[subscription_id] INTEGER NOT NULL, |
|
96
|
|
|
[started] TIMESTAMP NOT NULL, |
|
97
|
|
|
[stopped] TIMESTAMP, |
|
98
|
|
|
[title] VARCHAR(255) NOT NULL, |
|
99
|
|
|
[service] VARCHAR(255) NOT NULL, |
|
100
|
|
|
[input_id] INTEGER, |
|
101
|
|
|
UNIQUE ([id]), |
|
102
|
|
|
FOREIGN KEY ([channel_id]) REFERENCES [channel] ([id]), |
|
103
|
|
|
FOREIGN KEY ([user_id]) REFERENCES [user] ([id]), |
|
104
|
|
|
FOREIGN KEY ([instance_name]) REFERENCES [instance] ([name]) |
|
105
|
|
|
); |
|
106
|
|
|
|
|
107
|
|
|
INSERT INTO [subscription] (id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service) SELECT id, instance_name, user_id, channel_id, subscription_id, started, stopped, title, service FROM [subscription__temp__56bda64f128f1]; |
|
108
|
|
|
DROP TABLE [subscription__temp__56bda64f128f1]; |
|
109
|
|
|
|
|
110
|
|
|
PRAGMA foreign_keys = ON; |
|
111
|
|
|
', |
|
112
|
|
|
); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
} |
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.