@@ -1,309 +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 | 52 | t.column "possible_values", :text, :default => "" |
|
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 | 74 | t.column "value", :text, :default => "", :null => false |
|
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 | 81 | t.column "description", :text, :default => "" |
|
82 | 82 | t.column "created_on", :timestamp |
|
83 | end | |
|
83 | end | |
|
84 | ||
|
85 | add_index "documents", ["project_id"], :name => "documents_project_id" | |
|
84 | 86 | |
|
85 | 87 | create_table "enumerations", :force => true do |t| |
|
86 | 88 | t.column "opt", :string, :limit => 4, :default => "", :null => false |
|
87 | 89 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
88 | 90 | end |
|
89 | 91 | |
|
90 | 92 | create_table "issue_categories", :force => true do |t| |
|
91 | 93 | t.column "project_id", :integer, :default => 0, :null => false |
|
92 | 94 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
93 | end | |
|
95 | end | |
|
96 | ||
|
97 | add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" | |
|
94 | 98 | |
|
95 | 99 | create_table "issue_histories", :force => true do |t| |
|
96 | 100 | t.column "issue_id", :integer, :default => 0, :null => false |
|
97 | 101 | t.column "status_id", :integer, :default => 0, :null => false |
|
98 | 102 | t.column "author_id", :integer, :default => 0, :null => false |
|
99 | 103 | t.column "notes", :text, :default => "" |
|
100 | 104 | t.column "created_on", :timestamp |
|
101 | 105 | end |
|
102 | 106 | |
|
103 | 107 | add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id" |
|
104 | 108 | |
|
105 | 109 | create_table "issue_statuses", :force => true do |t| |
|
106 | 110 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
107 | 111 | t.column "is_closed", :boolean, :default => false, :null => false |
|
108 | 112 | t.column "is_default", :boolean, :default => false, :null => false |
|
109 | 113 | t.column "html_color", :string, :limit => 6, :default => "FFFFFF", :null => false |
|
110 | 114 | end |
|
111 | 115 | |
|
112 | 116 | create_table "issues", :force => true do |t| |
|
113 | 117 | t.column "tracker_id", :integer, :default => 0, :null => false |
|
114 | 118 | t.column "project_id", :integer, :default => 0, :null => false |
|
115 | 119 | t.column "subject", :string, :default => "", :null => false |
|
116 | 120 | t.column "description", :text, :default => "", :null => false |
|
117 | 121 | t.column "due_date", :date |
|
118 | 122 | t.column "category_id", :integer |
|
119 | 123 | t.column "status_id", :integer, :default => 0, :null => false |
|
120 | 124 | t.column "assigned_to_id", :integer |
|
121 | 125 | t.column "priority_id", :integer, :default => 0, :null => false |
|
122 | 126 | t.column "fixed_version_id", :integer |
|
123 | 127 | t.column "author_id", :integer, :default => 0, :null => false |
|
124 | 128 | t.column "lock_version", :integer, :default => 0, :null => false |
|
125 | 129 | t.column "created_on", :timestamp |
|
126 | 130 | t.column "updated_on", :timestamp |
|
127 | 131 | end |
|
128 | 132 | |
|
129 | 133 | add_index "issues", ["project_id"], :name => "issues_project_id" |
|
130 | 134 | |
|
131 | 135 | create_table "members", :force => true do |t| |
|
132 | 136 | t.column "user_id", :integer, :default => 0, :null => false |
|
133 | 137 | t.column "project_id", :integer, :default => 0, :null => false |
|
134 | 138 | t.column "role_id", :integer, :default => 0, :null => false |
|
135 | 139 | t.column "created_on", :timestamp |
|
136 | 140 | end |
|
137 | 141 | |
|
138 | 142 | create_table "news", :force => true do |t| |
|
139 | 143 | t.column "project_id", :integer |
|
140 | 144 | t.column "title", :string, :limit => 60, :default => "", :null => false |
|
141 | 145 | t.column "summary", :string, :limit => 255, :default => "" |
|
142 | 146 | t.column "description", :text, :default => "", :null => false |
|
143 | 147 | t.column "author_id", :integer, :default => 0, :null => false |
|
144 | 148 | t.column "created_on", :timestamp |
|
145 | end | |
|
149 | end | |
|
150 | ||
|
151 | add_index "news", ["project_id"], :name => "news_project_id" | |
|
146 | 152 | |
|
147 | 153 | create_table "permissions", :force => true do |t| |
|
148 | 154 | t.column "controller", :string, :limit => 30, :default => "", :null => false |
|
149 | 155 | t.column "action", :string, :limit => 30, :default => "", :null => false |
|
150 | 156 | t.column "description", :string, :limit => 60, :default => "", :null => false |
|
151 | 157 | t.column "is_public", :boolean, :default => false, :null => false |
|
152 | 158 | t.column "sort", :integer, :default => 0, :null => false |
|
153 | 159 | t.column "mail_option", :boolean, :default => false, :null => false |
|
154 | 160 | t.column "mail_enabled", :boolean, :default => false, :null => false |
|
155 | 161 | end |
|
156 | 162 | |
|
157 | 163 | create_table "permissions_roles", :id => false, :force => true do |t| |
|
158 | 164 | t.column "permission_id", :integer, :default => 0, :null => false |
|
159 | 165 | t.column "role_id", :integer, :default => 0, :null => false |
|
160 | 166 | end |
|
161 | 167 | |
|
162 | 168 | add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id" |
|
163 | 169 | |
|
164 | 170 | create_table "projects", :force => true do |t| |
|
165 | 171 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
166 | 172 | t.column "description", :string, :default => "", :null => false |
|
167 | 173 | t.column "homepage", :string, :limit => 60, :default => "" |
|
168 | 174 | t.column "is_public", :boolean, :default => true, :null => false |
|
169 | 175 | t.column "parent_id", :integer |
|
170 | 176 | t.column "projects_count", :integer, :default => 0 |
|
171 | 177 | t.column "created_on", :timestamp |
|
172 | 178 | t.column "updated_on", :timestamp |
|
173 | 179 | end |
|
174 | 180 | |
|
175 | 181 | create_table "roles", :force => true do |t| |
|
176 | 182 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
177 | 183 | end |
|
178 | 184 | |
|
179 | 185 | create_table "tokens", :force => true do |t| |
|
180 | 186 | t.column "user_id", :integer, :default => 0, :null => false |
|
181 | 187 | t.column "action", :string, :limit => 30, :default => "", :null => false |
|
182 | 188 | t.column "value", :string, :limit => 40, :default => "", :null => false |
|
183 | 189 | t.column "created_on", :datetime, :null => false |
|
184 | 190 | end |
|
185 | 191 | |
|
186 | 192 | create_table "trackers", :force => true do |t| |
|
187 | 193 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
188 | 194 | t.column "is_in_chlog", :boolean, :default => false, :null => false |
|
189 | 195 | end |
|
190 | 196 | |
|
191 | 197 | create_table "users", :force => true do |t| |
|
192 | 198 | t.column "login", :string, :limit => 30, :default => "", :null => false |
|
193 | 199 | t.column "hashed_password", :string, :limit => 40, :default => "", :null => false |
|
194 | 200 | t.column "firstname", :string, :limit => 30, :default => "", :null => false |
|
195 | 201 | t.column "lastname", :string, :limit => 30, :default => "", :null => false |
|
196 | 202 | t.column "mail", :string, :limit => 60, :default => "", :null => false |
|
197 | 203 | t.column "mail_notification", :boolean, :default => true, :null => false |
|
198 | 204 | t.column "admin", :boolean, :default => false, :null => false |
|
199 | 205 | t.column "status", :integer, :default => 1, :null => false |
|
200 | 206 | t.column "last_login_on", :datetime |
|
201 | 207 | t.column "language", :string, :limit => 2, :default => "" |
|
202 | 208 | t.column "auth_source_id", :integer |
|
203 | 209 | t.column "created_on", :timestamp |
|
204 | 210 | t.column "updated_on", :timestamp |
|
205 | 211 | end |
|
206 | 212 | |
|
207 | 213 | create_table "versions", :force => true do |t| |
|
208 | 214 | t.column "project_id", :integer, :default => 0, :null => false |
|
209 | 215 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
210 | 216 | t.column "description", :string, :default => "" |
|
211 | 217 | t.column "effective_date", :date, :null => false |
|
212 | 218 | t.column "created_on", :timestamp |
|
213 | 219 | t.column "updated_on", :timestamp |
|
214 | end | |
|
220 | end | |
|
221 | ||
|
222 | add_index "versions", ["project_id"], :name => "versions_project_id" | |
|
215 | 223 | |
|
216 | 224 | create_table "workflows", :force => true do |t| |
|
217 | 225 | t.column "tracker_id", :integer, :default => 0, :null => false |
|
218 | 226 | t.column "old_status_id", :integer, :default => 0, :null => false |
|
219 | 227 | t.column "new_status_id", :integer, :default => 0, :null => false |
|
220 | 228 | t.column "role_id", :integer, :default => 0, :null => false |
|
221 | 229 | end |
|
222 | 230 | |
|
223 | 231 | # project |
|
224 | 232 | Permission.create :controller => "projects", :action => "show", :description => "label_overview", :sort => 100, :is_public => true |
|
225 | 233 | Permission.create :controller => "projects", :action => "changelog", :description => "label_change_log", :sort => 105, :is_public => true |
|
226 | 234 | Permission.create :controller => "reports", :action => "issue_report", :description => "label_report_plural", :sort => 110, :is_public => true |
|
227 | 235 | Permission.create :controller => "projects", :action => "settings", :description => "label_settings", :sort => 150 |
|
228 | 236 | Permission.create :controller => "projects", :action => "edit", :description => "button_edit", :sort => 151 |
|
229 | 237 | # members |
|
230 | 238 | Permission.create :controller => "projects", :action => "list_members", :description => "button_list", :sort => 200, :is_public => true |
|
231 | 239 | Permission.create :controller => "projects", :action => "add_member", :description => "button_add", :sort => 220 |
|
232 | 240 | Permission.create :controller => "members", :action => "edit", :description => "button_edit", :sort => 221 |
|
233 | 241 | Permission.create :controller => "members", :action => "destroy", :description => "button_delete", :sort => 222 |
|
234 | 242 | # versions |
|
235 | 243 | Permission.create :controller => "projects", :action => "add_version", :description => "button_add", :sort => 320 |
|
236 | 244 | Permission.create :controller => "versions", :action => "edit", :description => "button_edit", :sort => 321 |
|
237 | 245 | Permission.create :controller => "versions", :action => "destroy", :description => "button_delete", :sort => 322 |
|
238 | 246 | # issue categories |
|
239 | 247 | Permission.create :controller => "projects", :action => "add_issue_category", :description => "button_add", :sort => 420 |
|
240 | 248 | Permission.create :controller => "issue_categories", :action => "edit", :description => "button_edit", :sort => 421 |
|
241 | 249 | Permission.create :controller => "issue_categories", :action => "destroy", :description => "button_delete", :sort => 422 |
|
242 | 250 | # issues |
|
243 | 251 | Permission.create :controller => "projects", :action => "list_issues", :description => "button_list", :sort => 1000, :is_public => true |
|
244 | 252 | Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true |
|
245 | 253 | Permission.create :controller => "issues", :action => "show", :description => "button_view", :sort => 1005, :is_public => true |
|
246 | 254 | Permission.create :controller => "issues", :action => "download", :description => "button_download", :sort => 1010, :is_public => true |
|
247 | 255 | Permission.create :controller => "projects", :action => "add_issue", :description => "button_add", :sort => 1050, :mail_option => 1, :mail_enabled => 1 |
|
248 | 256 | Permission.create :controller => "issues", :action => "edit", :description => "button_edit", :sort => 1055 |
|
249 | 257 | Permission.create :controller => "issues", :action => "change_status", :description => "label_change_status", :sort => 1060, :mail_option => 1, :mail_enabled => 1 |
|
250 | 258 | Permission.create :controller => "issues", :action => "destroy", :description => "button_delete", :sort => 1065 |
|
251 | 259 | Permission.create :controller => "issues", :action => "add_attachment", :description => "label_attachment_new", :sort => 1070 |
|
252 | 260 | Permission.create :controller => "issues", :action => "destroy_attachment", :description => "label_attachment_delete", :sort => 1075 |
|
253 | 261 | # news |
|
254 | 262 | Permission.create :controller => "projects", :action => "list_news", :description => "button_list", :sort => 1100, :is_public => true |
|
255 | 263 | Permission.create :controller => "news", :action => "show", :description => "button_view", :sort => 1101, :is_public => true |
|
256 | 264 | Permission.create :controller => "projects", :action => "add_news", :description => "button_add", :sort => 1120 |
|
257 | 265 | Permission.create :controller => "news", :action => "edit", :description => "button_edit", :sort => 1121 |
|
258 | 266 | Permission.create :controller => "news", :action => "destroy", :description => "button_delete", :sort => 1122 |
|
259 | 267 | # documents |
|
260 | 268 | Permission.create :controller => "projects", :action => "list_documents", :description => "button_list", :sort => 1200, :is_public => true |
|
261 | 269 | Permission.create :controller => "documents", :action => "show", :description => "button_view", :sort => 1201, :is_public => true |
|
262 | 270 | Permission.create :controller => "documents", :action => "download", :description => "button_download", :sort => 1202, :is_public => true |
|
263 | 271 | Permission.create :controller => "projects", :action => "add_document", :description => "button_add", :sort => 1220 |
|
264 | 272 | Permission.create :controller => "documents", :action => "edit", :description => "button_edit", :sort => 1221 |
|
265 | 273 | Permission.create :controller => "documents", :action => "destroy", :description => "button_delete", :sort => 1222 |
|
266 | 274 | Permission.create :controller => "documents", :action => "add_attachment", :description => "label_attachment_new", :sort => 1223 |
|
267 | 275 | Permission.create :controller => "documents", :action => "destroy_attachment", :description => "label_attachment_delete", :sort => 1224 |
|
268 | 276 | # files |
|
269 | 277 | Permission.create :controller => "projects", :action => "list_files", :description => "button_list", :sort => 1300, :is_public => true |
|
270 | 278 | Permission.create :controller => "versions", :action => "download", :description => "button_download", :sort => 1301, :is_public => true |
|
271 | 279 | Permission.create :controller => "projects", :action => "add_file", :description => "button_add", :sort => 1320 |
|
272 | 280 | Permission.create :controller => "versions", :action => "destroy_file", :description => "button_delete", :sort => 1322 |
|
273 | 281 | |
|
274 | 282 | # create default administrator account |
|
275 | 283 | user = User.create :firstname => "redMine", :lastname => "Admin", :mail => "admin@somenet.foo", :mail_notification => true, :language => "en" |
|
276 | 284 | user.login = "admin" |
|
277 | 285 | user.password = "admin" |
|
278 | 286 | user.admin = true |
|
279 | 287 | user.save |
|
280 | 288 | |
|
281 | 289 | |
|
282 | 290 | end |
|
283 | 291 | |
|
284 | 292 | def self.down |
|
285 | 293 | drop_table :attachments |
|
286 | 294 | drop_table :auth_sources |
|
287 | 295 | drop_table :custom_fields |
|
288 | 296 | drop_table :custom_fields_projects |
|
289 | 297 | drop_table :custom_fields_trackers |
|
290 | 298 | drop_table :custom_values |
|
291 | 299 | drop_table :documents |
|
292 | 300 | drop_table :enumerations |
|
293 | 301 | drop_table :issue_categories |
|
294 | 302 | drop_table :issue_histories |
|
295 | 303 | drop_table :issue_statuses |
|
296 | 304 | drop_table :issues |
|
297 | 305 | drop_table :members |
|
298 | 306 | drop_table :news |
|
299 | 307 | drop_table :permissions |
|
300 | 308 | drop_table :permissions_roles |
|
301 | 309 | drop_table :projects |
|
302 | 310 | drop_table :roles |
|
303 | 311 | drop_table :trackers |
|
304 | 312 | drop_table :tokens |
|
305 | 313 | drop_table :users |
|
306 | 314 | drop_table :versions |
|
307 | 315 | drop_table :workflows |
|
308 | 316 | end |
|
309 | 317 | end |
General Comments 0
You need to be logged in to leave comments.
Login now