Project

General

Profile

Feature #3125 » migrate.txt

General migration.. - Kiall Mac Innes, 2009-04-29 15:08

 
1
// Remove Index's
2
ALTER TABLE `attachments` CHANGE `id` `id` INT( 11 ) NOT NULL;
3
ALTER TABLE `auth_sources` CHANGE `id` `id` INT( 11 ) NOT NULL;
4
ALTER TABLE `boards` CHANGE `id` `id` INT( 11 ) NOT NULL;
5
ALTER TABLE `changes` CHANGE `id` `id` INT( 11 ) NOT NULL;
6
ALTER TABLE `changesets` CHANGE `id` `id` INT( 11 ) NOT NULL;
7
ALTER TABLE `comments` CHANGE `id` `id` INT( 11 ) NOT NULL;
8
ALTER TABLE `custom_fields` CHANGE `id` `id` INT( 11 ) NOT NULL;
9
ALTER TABLE `custom_values` CHANGE `id` `id` INT( 11 ) NOT NULL;
10
ALTER TABLE `documents` CHANGE `id` `id` INT( 11 ) NOT NULL;
11
ALTER TABLE `enabled_modules` CHANGE `id` `id` INT( 11 ) NOT NULL;
12
ALTER TABLE `enumerations` CHANGE `id` `id` INT( 11 ) NOT NULL;
13
ALTER TABLE `issues` CHANGE `id` `id` INT( 11 ) NOT NULL;
14
ALTER TABLE `issue_categories` CHANGE `id` `id` INT( 11 ) NOT NULL;
15
ALTER TABLE `issue_relations` CHANGE `id` `id` INT( 11 ) NOT NULL;
16
ALTER TABLE `issue_statuses` CHANGE `id` `id` INT( 11 ) NOT NULL;
17
ALTER TABLE `journals` CHANGE `id` `id` INT( 11 ) NOT NULL;
18
ALTER TABLE `journal_details` CHANGE `id` `id` INT( 11 ) NOT NULL;
19
ALTER TABLE `members` CHANGE `id` `id` INT( 11 ) NOT NULL;
20
ALTER TABLE `messages` CHANGE `id` `id` INT( 11 ) NOT NULL;
21
ALTER TABLE `news` CHANGE `id` `id` INT( 11 ) NOT NULL;
22
ALTER TABLE `projects` CHANGE `id` `id` INT( 11 ) NOT NULL;
23
ALTER TABLE `queries` CHANGE `id` `id` INT( 11 ) NOT NULL;
24
ALTER TABLE `repositories` CHANGE `id` `id` INT( 11 ) NOT NULL;
25
ALTER TABLE `roles` CHANGE `id` `id` INT( 11 ) NOT NULL;
26
ALTER TABLE `settings` CHANGE `id` `id` INT( 11 ) NOT NULL;
27
ALTER TABLE `time_entries` CHANGE `id` `id` INT( 11 ) NOT NULL;
28
ALTER TABLE `tokens` CHANGE `id` `id` INT( 11 ) NOT NULL;
29
ALTER TABLE `trackers` CHANGE `id` `id` INT( 11 ) NOT NULL;
30
ALTER TABLE `users` CHANGE `id` `id` INT( 11 ) NOT NULL;
31
ALTER TABLE `user_preferences` CHANGE `id` `id` INT( 11 ) NOT NULL;
32
ALTER TABLE `versions` CHANGE `id` `id` INT( 11 ) NOT NULL;
33
ALTER TABLE `watchers` CHANGE `id` `id` INT( 11 ) NOT NULL;
34
ALTER TABLE `wikis` CHANGE `id` `id` INT( 11 ) NOT NULL;
35
ALTER TABLE `wiki_contents` CHANGE `id` `id` INT( 11 ) NOT NULL;
36
ALTER TABLE `wiki_content_versions` CHANGE `id` `id` INT( 11 ) NOT NULL;
37
ALTER TABLE `wiki_pages` CHANGE `id` `id` INT( 11 ) NOT NULL;
38
ALTER TABLE `wiki_redirects` CHANGE `id` `id` INT( 11 ) NOT NULL;
39
ALTER TABLE `workflows` CHANGE `id` `id` INT( 11 ) NOT NULL;
40

    
41
ALTER TABLE `custom_fields` DROP PRIMARY KEY;
42
ALTER TABLE `custom_fields_projects` DROP PRIMARY KEY;
43
ALTER TABLE `custom_fields_trackers` DROP PRIMARY KEY;
44
ALTER TABLE `custom_values` DROP PRIMARY KEY;
45
ALTER TABLE `documents` DROP PRIMARY KEY;
46
ALTER TABLE `enabled_modules` DROP PRIMARY KEY;
47
ALTER TABLE `enumerations` DROP PRIMARY KEY;
48
ALTER TABLE `issues` DROP PRIMARY KEY;
49
ALTER TABLE `issue_categories` DROP PRIMARY KEY;
50
ALTER TABLE `issue_relations` DROP PRIMARY KEY;
51
ALTER TABLE `issue_statuses` DROP PRIMARY KEY;
52
ALTER TABLE `journals` DROP PRIMARY KEY;
53
ALTER TABLE `journal_details` DROP PRIMARY KEY;
54
ALTER TABLE `members` DROP PRIMARY KEY;
55
ALTER TABLE `messages` DROP PRIMARY KEY;
56
ALTER TABLE `news` DROP PRIMARY KEY;
57
ALTER TABLE `plugin_schema_info` DROP PRIMARY KEY;
58
ALTER TABLE `projects` DROP PRIMARY KEY;
59
ALTER TABLE `projects_trackers` DROP PRIMARY KEY;
60
ALTER TABLE `queries` DROP PRIMARY KEY;
61
ALTER TABLE `repositories` DROP PRIMARY KEY;
62
ALTER TABLE `roles` DROP PRIMARY KEY;
63
ALTER TABLE `schema_migrations` DROP PRIMARY KEY;
64
ALTER TABLE `settings` DROP PRIMARY KEY;
65
ALTER TABLE `time_entries` DROP PRIMARY KEY;
66
ALTER TABLE `tokens` DROP PRIMARY KEY;
67
ALTER TABLE `trackers` DROP PRIMARY KEY;
68
ALTER TABLE `users` DROP PRIMARY KEY;
69
ALTER TABLE `user_preferences` DROP PRIMARY KEY;
70
ALTER TABLE `versions` DROP PRIMARY KEY;
71
ALTER TABLE `watchers` DROP PRIMARY KEY;
72
ALTER TABLE `wikis` DROP PRIMARY KEY;
73
ALTER TABLE `wiki_contents` DROP PRIMARY KEY;
74
ALTER TABLE `wiki_content_versions` DROP PRIMARY KEY;
75
ALTER TABLE `wiki_pages` DROP PRIMARY KEY;
76
ALTER TABLE `wiki_redirects` DROP PRIMARY KEY;
77
ALTER TABLE `workflows` DROP PRIMARY KEY;
78

    
79

    
80
// MISC
81
TRUNCATE TABLE `changes`;
82
TRUNCATE TABLE `changesets`;
83
TRUNCATE TABLE `changesets_issues`;
84

    
85

    
86
//Category IDs
87
UPDATE issue_categories SET id = id + 17;
88
UPDATE issues SET category_id = category_id + 17;
89

    
90
//User IDs
91
UPDATE users SET id = id + 380;
92
UPDATE messages SET author_id = author_id + 380;
93
UPDATE messages SET last_reply_id = last_reply_id + 380;
94
UPDATE news SET author_id = author_id + 380;
95
UPDATE queries SET user_id = user_id + 380;
96
UPDATE time_entries SET user_id = user_id + 380;
97
UPDATE user_preferences SET user_id = user_id + 380;
98
UPDATE watchers SET user_id = user_id + 380;
99
UPDATE wiki_contents SET author_id = author_id + 380;
100
UPDATE wiki_content_versions SET author_id = author_id + 380;
101
UPDATE issues SET assigned_to_id = assigned_to_id + 380;
102
UPDATE issues SET author_id = author_id + 380;
103
UPDATE issue_categories SET assigned_to_id = assigned_to_id + 380;
104
UPDATE journals SET user_id = user_id + 380;
105
UPDATE journal_details SET old_value = old_value + 380 WHERE prop_key = 'assigned_to_id' AND old_value != NULL;
106
UPDATE journal_details SET value = value + 380 WHERE prop_key = 'assigned_to_id' AND value != NULL;
107
UPDATE members SET user_id = user_id + 380;
108
UPDATE tokens SET user_id = user_id + 380;
109

    
110
//User Preference IDs
111
// NO NEED // UPDATE user_preferences SET id = id + XXX;
112

    
113
//Verson IDs
114
UPDATE versions SET id = id + 12;
115
UPDATE attachments set container_id = container_id + 12 where container_type = 'Version';
116
UPDATE issues SET fixed_version_id = fixed_version_id + 12;
117

    
118
// Journal IDs
119
UPDATE journals SET id = id + 3204;
120
UPDATE journal_details SET journal_id = journal_id + 3204;
121

    
122
// Journal Detail IDs
123
UPDATE journal_details SET id = id + 3316;
124

    
125
// Member IDs
126
UPDATE members SET id = id + 33;
127

    
128
// Wiki IDs
129
UPDATE wikis SET id = id + 1;
130
UPDATE wiki_pages SET wiki_id = wiki_id + 1;
131

    
132
// Wiki Contents IDs
133
UPDATE wiki_contents SET id = id + 26;
134
UPDATE wiki_content_versions SET wiki_content_id = wiki_content_id + 26;
135

    
136
// Wiki Content Version IDs
137
UPDATE wiki_content_versions SET id = id + 232;
138

    
139
// Wiki Page IDs
140
UPDATE wiki_pages SET id = id + 26;
141
UPDATE wiki_contents SET page_id = page_id + 26;
142
UPDATE wiki_content_versions SET page_id = page_id + 26;
143

    
144
// Custom Field IDs
145
UPDATE custom_fields SET id = id + 2;
146
UPDATE custom_fields SET position = position + 2;
147
UPDATE custom_values SET custom_field_id = custom_field_id + 2 where customized_type = 'Project';
148

    
149
// Attachment IDs
150
UPDATE attachments SET id = id + 433;
151
UPDATE journal_details SET prop_key = prop_key + 433 WHERE property = 'attachment';
152

    
153
// Custom Values
154
UPDATE custom_values SET id = id + 2590;
(1-1/2)