##// END OF EJS Templates
fixed migration scripts to work with mysql 5 running in strict mode...
Jean-Philippe Lang -
r346:59e3802c7476
parent child
Show More
@@ -1,317 +1,317
1 1 # redMine - project management software
2 2 # Copyright (C) 2006 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 class Setup < ActiveRecord::Migration
19 19 def self.up
20 20 create_table "attachments", :force => true do |t|
21 21 t.column "container_id", :integer, :default => 0, :null => false
22 22 t.column "container_type", :string, :limit => 30, :default => "", :null => false
23 23 t.column "filename", :string, :default => "", :null => false
24 24 t.column "disk_filename", :string, :default => "", :null => false
25 25 t.column "filesize", :integer, :default => 0, :null => false
26 26 t.column "content_type", :string, :limit => 60, :default => ""
27 27 t.column "digest", :string, :limit => 40, :default => "", :null => false
28 28 t.column "downloads", :integer, :default => 0, :null => false
29 29 t.column "author_id", :integer, :default => 0, :null => false
30 30 t.column "created_on", :timestamp
31 31 end
32 32
33 33 create_table "auth_sources", :force => true do |t|
34 34 t.column "type", :string, :limit => 30, :default => "", :null => false
35 35 t.column "name", :string, :limit => 60, :default => "", :null => false
36 36 t.column "host", :string, :limit => 60
37 37 t.column "port", :integer
38 38 t.column "account", :string, :limit => 60
39 39 t.column "account_password", :string, :limit => 60
40 40 t.column "base_dn", :string, :limit => 255
41 41 t.column "attr_login", :string, :limit => 30
42 42 t.column "attr_firstname", :string, :limit => 30
43 43 t.column "attr_lastname", :string, :limit => 30
44 44 t.column "attr_mail", :string, :limit => 30
45 45 t.column "onthefly_register", :boolean, :default => false, :null => false
46 46 end
47 47
48 48 create_table "custom_fields", :force => true do |t|
49 49 t.column "type", :string, :limit => 30, :default => "", :null => false
50 50 t.column "name", :string, :limit => 30, :default => "", :null => false
51 51 t.column "field_format", :string, :limit => 30, :default => "", :null => false
52 t.column "possible_values", :text, :default => ""
52 t.column "possible_values", :text
53 53 t.column "regexp", :string, :default => ""
54 54 t.column "min_length", :integer, :default => 0, :null => false
55 55 t.column "max_length", :integer, :default => 0, :null => false
56 56 t.column "is_required", :boolean, :default => false, :null => false
57 57 t.column "is_for_all", :boolean, :default => false, :null => false
58 58 end
59 59
60 60 create_table "custom_fields_projects", :id => false, :force => true do |t|
61 61 t.column "custom_field_id", :integer, :default => 0, :null => false
62 62 t.column "project_id", :integer, :default => 0, :null => false
63 63 end
64 64
65 65 create_table "custom_fields_trackers", :id => false, :force => true do |t|
66 66 t.column "custom_field_id", :integer, :default => 0, :null => false
67 67 t.column "tracker_id", :integer, :default => 0, :null => false
68 68 end
69 69
70 70 create_table "custom_values", :force => true do |t|
71 71 t.column "customized_type", :string, :limit => 30, :default => "", :null => false
72 72 t.column "customized_id", :integer, :default => 0, :null => false
73 73 t.column "custom_field_id", :integer, :default => 0, :null => false
74 t.column "value", :text, :default => "", :null => false
74 t.column "value", :text
75 75 end
76 76
77 77 create_table "documents", :force => true do |t|
78 78 t.column "project_id", :integer, :default => 0, :null => false
79 79 t.column "category_id", :integer, :default => 0, :null => false
80 80 t.column "title", :string, :limit => 60, :default => "", :null => false
81 t.column "description", :text, :default => ""
81 t.column "description", :text
82 82 t.column "created_on", :timestamp
83 83 end
84 84
85 85 add_index "documents", ["project_id"], :name => "documents_project_id"
86 86
87 87 create_table "enumerations", :force => true do |t|
88 88 t.column "opt", :string, :limit => 4, :default => "", :null => false
89 89 t.column "name", :string, :limit => 30, :default => "", :null => false
90 90 end
91 91
92 92 create_table "issue_categories", :force => true do |t|
93 93 t.column "project_id", :integer, :default => 0, :null => false
94 94 t.column "name", :string, :limit => 30, :default => "", :null => false
95 95 end
96 96
97 97 add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
98 98
99 99 create_table "issue_histories", :force => true do |t|
100 100 t.column "issue_id", :integer, :default => 0, :null => false
101 101 t.column "status_id", :integer, :default => 0, :null => false
102 102 t.column "author_id", :integer, :default => 0, :null => false
103 t.column "notes", :text, :default => ""
103 t.column "notes", :text
104 104 t.column "created_on", :timestamp
105 105 end
106 106
107 107 add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id"
108 108
109 109 create_table "issue_statuses", :force => true do |t|
110 110 t.column "name", :string, :limit => 30, :default => "", :null => false
111 111 t.column "is_closed", :boolean, :default => false, :null => false
112 112 t.column "is_default", :boolean, :default => false, :null => false
113 113 t.column "html_color", :string, :limit => 6, :default => "FFFFFF", :null => false
114 114 end
115 115
116 116 create_table "issues", :force => true do |t|
117 117 t.column "tracker_id", :integer, :default => 0, :null => false
118 118 t.column "project_id", :integer, :default => 0, :null => false
119 119 t.column "subject", :string, :default => "", :null => false
120 t.column "description", :text, :default => "", :null => false
120 t.column "description", :text
121 121 t.column "due_date", :date
122 122 t.column "category_id", :integer
123 123 t.column "status_id", :integer, :default => 0, :null => false
124 124 t.column "assigned_to_id", :integer
125 125 t.column "priority_id", :integer, :default => 0, :null => false
126 126 t.column "fixed_version_id", :integer
127 127 t.column "author_id", :integer, :default => 0, :null => false
128 128 t.column "lock_version", :integer, :default => 0, :null => false
129 129 t.column "created_on", :timestamp
130 130 t.column "updated_on", :timestamp
131 131 end
132 132
133 133 add_index "issues", ["project_id"], :name => "issues_project_id"
134 134
135 135 create_table "members", :force => true do |t|
136 136 t.column "user_id", :integer, :default => 0, :null => false
137 137 t.column "project_id", :integer, :default => 0, :null => false
138 138 t.column "role_id", :integer, :default => 0, :null => false
139 139 t.column "created_on", :timestamp
140 140 end
141 141
142 142 create_table "news", :force => true do |t|
143 143 t.column "project_id", :integer
144 144 t.column "title", :string, :limit => 60, :default => "", :null => false
145 145 t.column "summary", :string, :limit => 255, :default => ""
146 t.column "description", :text, :default => "", :null => false
146 t.column "description", :text
147 147 t.column "author_id", :integer, :default => 0, :null => false
148 148 t.column "created_on", :timestamp
149 149 end
150 150
151 151 add_index "news", ["project_id"], :name => "news_project_id"
152 152
153 153 create_table "permissions", :force => true do |t|
154 154 t.column "controller", :string, :limit => 30, :default => "", :null => false
155 155 t.column "action", :string, :limit => 30, :default => "", :null => false
156 156 t.column "description", :string, :limit => 60, :default => "", :null => false
157 157 t.column "is_public", :boolean, :default => false, :null => false
158 158 t.column "sort", :integer, :default => 0, :null => false
159 159 t.column "mail_option", :boolean, :default => false, :null => false
160 160 t.column "mail_enabled", :boolean, :default => false, :null => false
161 161 end
162 162
163 163 create_table "permissions_roles", :id => false, :force => true do |t|
164 164 t.column "permission_id", :integer, :default => 0, :null => false
165 165 t.column "role_id", :integer, :default => 0, :null => false
166 166 end
167 167
168 168 add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
169 169
170 170 create_table "projects", :force => true do |t|
171 171 t.column "name", :string, :limit => 30, :default => "", :null => false
172 172 t.column "description", :string, :default => "", :null => false
173 173 t.column "homepage", :string, :limit => 60, :default => ""
174 174 t.column "is_public", :boolean, :default => true, :null => false
175 175 t.column "parent_id", :integer
176 176 t.column "projects_count", :integer, :default => 0
177 177 t.column "created_on", :timestamp
178 178 t.column "updated_on", :timestamp
179 179 end
180 180
181 181 create_table "roles", :force => true do |t|
182 182 t.column "name", :string, :limit => 30, :default => "", :null => false
183 183 end
184 184
185 185 create_table "tokens", :force => true do |t|
186 186 t.column "user_id", :integer, :default => 0, :null => false
187 187 t.column "action", :string, :limit => 30, :default => "", :null => false
188 188 t.column "value", :string, :limit => 40, :default => "", :null => false
189 189 t.column "created_on", :datetime, :null => false
190 190 end
191 191
192 192 create_table "trackers", :force => true do |t|
193 193 t.column "name", :string, :limit => 30, :default => "", :null => false
194 194 t.column "is_in_chlog", :boolean, :default => false, :null => false
195 195 end
196 196
197 197 create_table "users", :force => true do |t|
198 198 t.column "login", :string, :limit => 30, :default => "", :null => false
199 199 t.column "hashed_password", :string, :limit => 40, :default => "", :null => false
200 200 t.column "firstname", :string, :limit => 30, :default => "", :null => false
201 201 t.column "lastname", :string, :limit => 30, :default => "", :null => false
202 202 t.column "mail", :string, :limit => 60, :default => "", :null => false
203 203 t.column "mail_notification", :boolean, :default => true, :null => false
204 204 t.column "admin", :boolean, :default => false, :null => false
205 205 t.column "status", :integer, :default => 1, :null => false
206 206 t.column "last_login_on", :datetime
207 207 t.column "language", :string, :limit => 2, :default => ""
208 208 t.column "auth_source_id", :integer
209 209 t.column "created_on", :timestamp
210 210 t.column "updated_on", :timestamp
211 211 end
212 212
213 213 create_table "versions", :force => true do |t|
214 214 t.column "project_id", :integer, :default => 0, :null => false
215 215 t.column "name", :string, :limit => 30, :default => "", :null => false
216 216 t.column "description", :string, :default => ""
217 217 t.column "effective_date", :date, :null => false
218 218 t.column "created_on", :timestamp
219 219 t.column "updated_on", :timestamp
220 220 end
221 221
222 222 add_index "versions", ["project_id"], :name => "versions_project_id"
223 223
224 224 create_table "workflows", :force => true do |t|
225 225 t.column "tracker_id", :integer, :default => 0, :null => false
226 226 t.column "old_status_id", :integer, :default => 0, :null => false
227 227 t.column "new_status_id", :integer, :default => 0, :null => false
228 228 t.column "role_id", :integer, :default => 0, :null => false
229 229 end
230 230
231 231 # project
232 232 Permission.create :controller => "projects", :action => "show", :description => "label_overview", :sort => 100, :is_public => true
233 233 Permission.create :controller => "projects", :action => "changelog", :description => "label_change_log", :sort => 105, :is_public => true
234 234 Permission.create :controller => "reports", :action => "issue_report", :description => "label_report_plural", :sort => 110, :is_public => true
235 235 Permission.create :controller => "projects", :action => "settings", :description => "label_settings", :sort => 150
236 236 Permission.create :controller => "projects", :action => "edit", :description => "button_edit", :sort => 151
237 237 # members
238 238 Permission.create :controller => "projects", :action => "list_members", :description => "button_list", :sort => 200, :is_public => true
239 239 Permission.create :controller => "projects", :action => "add_member", :description => "button_add", :sort => 220
240 240 Permission.create :controller => "members", :action => "edit", :description => "button_edit", :sort => 221
241 241 Permission.create :controller => "members", :action => "destroy", :description => "button_delete", :sort => 222
242 242 # versions
243 243 Permission.create :controller => "projects", :action => "add_version", :description => "button_add", :sort => 320
244 244 Permission.create :controller => "versions", :action => "edit", :description => "button_edit", :sort => 321
245 245 Permission.create :controller => "versions", :action => "destroy", :description => "button_delete", :sort => 322
246 246 # issue categories
247 247 Permission.create :controller => "projects", :action => "add_issue_category", :description => "button_add", :sort => 420
248 248 Permission.create :controller => "issue_categories", :action => "edit", :description => "button_edit", :sort => 421
249 249 Permission.create :controller => "issue_categories", :action => "destroy", :description => "button_delete", :sort => 422
250 250 # issues
251 251 Permission.create :controller => "projects", :action => "list_issues", :description => "button_list", :sort => 1000, :is_public => true
252 252 Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true
253 253 Permission.create :controller => "issues", :action => "show", :description => "button_view", :sort => 1005, :is_public => true
254 254 Permission.create :controller => "issues", :action => "download", :description => "button_download", :sort => 1010, :is_public => true
255 255 Permission.create :controller => "projects", :action => "add_issue", :description => "button_add", :sort => 1050, :mail_option => 1, :mail_enabled => 1
256 256 Permission.create :controller => "issues", :action => "edit", :description => "button_edit", :sort => 1055
257 257 Permission.create :controller => "issues", :action => "change_status", :description => "label_change_status", :sort => 1060, :mail_option => 1, :mail_enabled => 1
258 258 Permission.create :controller => "issues", :action => "destroy", :description => "button_delete", :sort => 1065
259 259 Permission.create :controller => "issues", :action => "add_attachment", :description => "label_attachment_new", :sort => 1070
260 260 Permission.create :controller => "issues", :action => "destroy_attachment", :description => "label_attachment_delete", :sort => 1075
261 261 # news
262 262 Permission.create :controller => "projects", :action => "list_news", :description => "button_list", :sort => 1100, :is_public => true
263 263 Permission.create :controller => "news", :action => "show", :description => "button_view", :sort => 1101, :is_public => true
264 264 Permission.create :controller => "projects", :action => "add_news", :description => "button_add", :sort => 1120
265 265 Permission.create :controller => "news", :action => "edit", :description => "button_edit", :sort => 1121
266 266 Permission.create :controller => "news", :action => "destroy", :description => "button_delete", :sort => 1122
267 267 # documents
268 268 Permission.create :controller => "projects", :action => "list_documents", :description => "button_list", :sort => 1200, :is_public => true
269 269 Permission.create :controller => "documents", :action => "show", :description => "button_view", :sort => 1201, :is_public => true
270 270 Permission.create :controller => "documents", :action => "download", :description => "button_download", :sort => 1202, :is_public => true
271 271 Permission.create :controller => "projects", :action => "add_document", :description => "button_add", :sort => 1220
272 272 Permission.create :controller => "documents", :action => "edit", :description => "button_edit", :sort => 1221
273 273 Permission.create :controller => "documents", :action => "destroy", :description => "button_delete", :sort => 1222
274 274 Permission.create :controller => "documents", :action => "add_attachment", :description => "label_attachment_new", :sort => 1223
275 275 Permission.create :controller => "documents", :action => "destroy_attachment", :description => "label_attachment_delete", :sort => 1224
276 276 # files
277 277 Permission.create :controller => "projects", :action => "list_files", :description => "button_list", :sort => 1300, :is_public => true
278 278 Permission.create :controller => "versions", :action => "download", :description => "button_download", :sort => 1301, :is_public => true
279 279 Permission.create :controller => "projects", :action => "add_file", :description => "button_add", :sort => 1320
280 280 Permission.create :controller => "versions", :action => "destroy_file", :description => "button_delete", :sort => 1322
281 281
282 282 # create default administrator account
283 283 user = User.create :firstname => "redMine", :lastname => "Admin", :mail => "admin@somenet.foo", :mail_notification => true, :language => "en"
284 284 user.login = "admin"
285 285 user.password = "admin"
286 286 user.admin = true
287 287 user.save
288 288
289 289
290 290 end
291 291
292 292 def self.down
293 293 drop_table :attachments
294 294 drop_table :auth_sources
295 295 drop_table :custom_fields
296 296 drop_table :custom_fields_projects
297 297 drop_table :custom_fields_trackers
298 298 drop_table :custom_values
299 299 drop_table :documents
300 300 drop_table :enumerations
301 301 drop_table :issue_categories
302 302 drop_table :issue_histories
303 303 drop_table :issue_statuses
304 304 drop_table :issues
305 305 drop_table :members
306 306 drop_table :news
307 307 drop_table :permissions
308 308 drop_table :permissions_roles
309 309 drop_table :projects
310 310 drop_table :roles
311 311 drop_table :trackers
312 312 drop_table :tokens
313 313 drop_table :users
314 314 drop_table :versions
315 315 drop_table :workflows
316 316 end
317 317 end
@@ -1,16 +1,16
1 1 class CreateComments < ActiveRecord::Migration
2 2 def self.up
3 3 create_table :comments do |t|
4 4 t.column :commented_type, :string, :limit => 30, :default => "", :null => false
5 5 t.column :commented_id, :integer, :default => 0, :null => false
6 6 t.column :author_id, :integer, :default => 0, :null => false
7 t.column :comment, :text, :default => "", :null => false
7 t.column :comment, :text
8 8 t.column :created_on, :datetime, :null => false
9 9 t.column :updated_on, :datetime, :null => false
10 10 end
11 11 end
12 12
13 13 def self.down
14 14 drop_table :comments
15 15 end
16 16 end
@@ -1,30 +1,30
1 1 class CreateWikiContents < ActiveRecord::Migration
2 2 def self.up
3 3 create_table :wiki_contents do |t|
4 4 t.column :page_id, :integer, :null => false
5 5 t.column :author_id, :integer
6 t.column :text, :text, :default => "", :null => false
6 t.column :text, :text
7 7 t.column :comment, :string, :limit => 255, :default => ""
8 8 t.column :updated_on, :datetime, :null => false
9 9 t.column :version, :integer, :null => false
10 10 end
11 11 add_index :wiki_contents, :page_id, :name => :wiki_contents_page_id
12 12
13 13 create_table :wiki_content_versions do |t|
14 14 t.column :wiki_content_id, :integer, :null => false
15 15 t.column :page_id, :integer, :null => false
16 16 t.column :author_id, :integer
17 17 t.column :data, :binary
18 18 t.column :compression, :string, :limit => 6, :default => ""
19 19 t.column :comment, :string, :limit => 255, :default => ""
20 20 t.column :updated_on, :datetime, :null => false
21 21 t.column :version, :integer, :null => false
22 22 end
23 23 add_index :wiki_content_versions, :wiki_content_id, :name => :wiki_content_versions_wcid
24 24 end
25 25
26 26 def self.down
27 27 drop_table :wiki_contents
28 28 drop_table :wiki_content_versions
29 29 end
30 30 end
General Comments 0
You need to be logged in to leave comments. Login now