##// END OF EJS Templates
0.3 unstable...
Jean-Philippe Lang -
r9:7e57db1edbad
parent child
Show More
@@ -1,275 +1,307
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
33 create_table "custom_fields", :force => true do |t|
32
33 create_table "auth_sources", :force => true do |t|
34 t.column "type", :string, :limit => 30, :default => "", :null => false
35 t.column "name", :string, :limit => 60, :default => "", :null => false
36 t.column "host", :string, :limit => 60
37 t.column "port", :integer
38 t.column "account", :string, :limit => 60
39 t.column "account_password", :string, :limit => 60
40 t.column "base_dn", :string, :limit => 255
41 t.column "attr_login", :string, :limit => 30
42 t.column "attr_firstname", :string, :limit => 30
43 t.column "attr_lastname", :string, :limit => 30
44 t.column "attr_mail", :string, :limit => 30
45 t.column "onthefly_register", :boolean, :default => false, :null => false
46 end
47
48 create_table "custom_fields", :force => true do |t|
49 t.column "type", :string, :limit => 30, :default => "", :null => false
34 50 t.column "name", :string, :limit => 30, :default => "", :null => false
35 t.column "typ", :integer, :default => 0, :null => false
36 t.column "is_required", :boolean, :default => false, :null => false
37 t.column "is_for_all", :boolean, :default => false, :null => false
51 t.column "field_format", :string, :limit => 30, :default => "", :null => false
38 52 t.column "possible_values", :text, :default => ""
39 53 t.column "regexp", :string, :default => ""
40 54 t.column "min_length", :integer, :default => 0, :null => false
41 55 t.column "max_length", :integer, :default => 0, :null => false
56 t.column "is_required", :boolean, :default => false, :null => false
57 t.column "is_for_all", :boolean, :default => false, :null => false
42 58 end
43 59
44 60 create_table "custom_fields_projects", :id => false, :force => true do |t|
45 61 t.column "custom_field_id", :integer, :default => 0, :null => false
46 62 t.column "project_id", :integer, :default => 0, :null => false
47 63 end
48
64
65 create_table "custom_fields_trackers", :id => false, :force => true do |t|
66 t.column "custom_field_id", :integer, :default => 0, :null => false
67 t.column "tracker_id", :integer, :default => 0, :null => false
68 end
69
49 70 create_table "custom_values", :force => true do |t|
50 t.column "issue_id", :integer, :default => 0, :null => false
71 t.column "customized_type", :string, :limit => 30, :default => "", :null => false
72 t.column "customized_id", :integer, :default => 0, :null => false
51 73 t.column "custom_field_id", :integer, :default => 0, :null => false
52 74 t.column "value", :text, :default => "", :null => false
53 75 end
54 76
55 add_index "custom_values", ["issue_id"], :name => "custom_values_issue_id"
56
57 77 create_table "documents", :force => true do |t|
58 78 t.column "project_id", :integer, :default => 0, :null => false
59 79 t.column "category_id", :integer, :default => 0, :null => false
60 80 t.column "title", :string, :limit => 60, :default => "", :null => false
61 t.column "descr", :text, :default => "", :null => false
81 t.column "description", :text, :default => "", :null => false
62 82 t.column "created_on", :timestamp
63 83 end
64 84
65 85 create_table "enumerations", :force => true do |t|
66 86 t.column "opt", :string, :limit => 4, :default => "", :null => false
67 87 t.column "name", :string, :limit => 30, :default => "", :null => false
68 88 end
69 89
70 90 create_table "issue_categories", :force => true do |t|
71 91 t.column "project_id", :integer, :default => 0, :null => false
72 92 t.column "name", :string, :limit => 30, :default => "", :null => false
73 93 end
74 94
75 95 create_table "issue_histories", :force => true do |t|
76 96 t.column "issue_id", :integer, :default => 0, :null => false
77 97 t.column "status_id", :integer, :default => 0, :null => false
78 98 t.column "author_id", :integer, :default => 0, :null => false
79 99 t.column "notes", :text, :default => ""
80 100 t.column "created_on", :timestamp
81 101 end
82 102
83 103 add_index "issue_histories", ["issue_id"], :name => "issue_histories_issue_id"
84 104
85 105 create_table "issue_statuses", :force => true do |t|
86 106 t.column "name", :string, :limit => 30, :default => "", :null => false
87 107 t.column "is_closed", :boolean, :default => false, :null => false
88 108 t.column "is_default", :boolean, :default => false, :null => false
89 109 t.column "html_color", :string, :limit => 6, :default => "FFFFFF", :null => false
90 110 end
91 111
92 112 create_table "issues", :force => true do |t|
93 113 t.column "tracker_id", :integer, :default => 0, :null => false
94 114 t.column "project_id", :integer, :default => 0, :null => false
95 115 t.column "subject", :string, :default => "", :null => false
96 t.column "descr", :text, :default => "", :null => false
116 t.column "description", :text, :default => "", :null => false
97 117 t.column "category_id", :integer
98 118 t.column "status_id", :integer, :default => 0, :null => false
99 119 t.column "assigned_to_id", :integer
100 120 t.column "priority_id", :integer, :default => 0, :null => false
101 121 t.column "fixed_version_id", :integer
102 122 t.column "author_id", :integer, :default => 0, :null => false
103 123 t.column "created_on", :timestamp
104 124 t.column "updated_on", :timestamp
105 125 end
106 126
107 127 add_index "issues", ["project_id"], :name => "issues_project_id"
108 128
109 129 create_table "members", :force => true do |t|
110 130 t.column "user_id", :integer, :default => 0, :null => false
111 131 t.column "project_id", :integer, :default => 0, :null => false
112 132 t.column "role_id", :integer, :default => 0, :null => false
113 133 t.column "created_on", :timestamp
114 134 end
115 135
116 136 create_table "news", :force => true do |t|
117 137 t.column "project_id", :integer
118 138 t.column "title", :string, :limit => 60, :default => "", :null => false
119 t.column "shortdescr", :string, :default => ""
120 t.column "descr", :text, :default => "", :null => false
139 t.column "summary", :string, :limit => 255, :default => ""
140 t.column "description", :text, :default => "", :null => false
121 141 t.column "author_id", :integer, :default => 0, :null => false
122 142 t.column "created_on", :timestamp
123 143 end
124 144
125 145 create_table "permissions", :force => true do |t|
126 146 t.column "controller", :string, :limit => 30, :default => "", :null => false
127 147 t.column "action", :string, :limit => 30, :default => "", :null => false
128 t.column "descr", :string, :limit => 60, :default => "", :null => false
148 t.column "description", :string, :limit => 60, :default => "", :null => false
129 149 t.column "is_public", :boolean, :default => false, :null => false
130 150 t.column "sort", :integer, :default => 0, :null => false
131 151 t.column "mail_option", :boolean, :default => false, :null => false
132 152 t.column "mail_enabled", :boolean, :default => false, :null => false
133 153 end
134 154
135 155 create_table "permissions_roles", :id => false, :force => true do |t|
136 156 t.column "permission_id", :integer, :default => 0, :null => false
137 157 t.column "role_id", :integer, :default => 0, :null => false
138 158 end
139 159
140 160 add_index "permissions_roles", ["role_id"], :name => "permissions_roles_role_id"
141 161
142 162 create_table "projects", :force => true do |t|
143 163 t.column "name", :string, :limit => 30, :default => "", :null => false
144 t.column "descr", :string, :default => "", :null => false
164 t.column "description", :string, :default => "", :null => false
145 165 t.column "homepage", :string, :limit => 60, :default => ""
146 166 t.column "is_public", :boolean, :default => true, :null => false
147 167 t.column "parent_id", :integer
148 168 t.column "projects_count", :integer, :default => 0
149 169 t.column "created_on", :timestamp
150 170 t.column "updated_on", :timestamp
151 171 end
152 172
153 173 create_table "roles", :force => true do |t|
154 174 t.column "name", :string, :limit => 30, :default => "", :null => false
155 175 end
176
177 create_table "tokens", :force => true do |t|
178 t.column "user_id", :integer, :default => 0, :null => false
179 t.column "action", :string, :limit => 30, :default => "", :null => false
180 t.column "value", :string, :limit => 40, :default => "", :null => false
181 t.column "created_on", :datetime, :null => false
182 end
156 183
157 184 create_table "trackers", :force => true do |t|
158 185 t.column "name", :string, :limit => 30, :default => "", :null => false
159 186 t.column "is_in_chlog", :boolean, :default => false, :null => false
160 187 end
161 188
162 189 create_table "users", :force => true do |t|
163 190 t.column "login", :string, :limit => 30, :default => "", :null => false
164 191 t.column "hashed_password", :string, :limit => 40, :default => "", :null => false
165 192 t.column "firstname", :string, :limit => 30, :default => "", :null => false
166 193 t.column "lastname", :string, :limit => 30, :default => "", :null => false
167 194 t.column "mail", :string, :limit => 60, :default => "", :null => false
168 195 t.column "mail_notification", :boolean, :default => true, :null => false
169 196 t.column "admin", :boolean, :default => false, :null => false
170 t.column "locked", :boolean, :default => false, :null => false
197 t.column "status", :integer, :default => 1, :null => false
171 198 t.column "last_login_on", :datetime
172 t.column "language", :string, :limit => 2, :default => "", :null => false
199 t.column "language", :string, :limit => 2, :default => ""
200 t.column "auth_source_id", :integer
173 201 t.column "created_on", :timestamp
174 202 t.column "updated_on", :timestamp
175 203 end
176 204
177 205 create_table "versions", :force => true do |t|
178 206 t.column "project_id", :integer, :default => 0, :null => false
179 207 t.column "name", :string, :limit => 30, :default => "", :null => false
180 t.column "descr", :string, :default => ""
208 t.column "description", :string, :default => ""
181 209 t.column "effective_date", :date, :null => false
182 210 t.column "created_on", :timestamp
183 211 t.column "updated_on", :timestamp
184 212 end
185 213
186 214 create_table "workflows", :force => true do |t|
187 215 t.column "tracker_id", :integer, :default => 0, :null => false
188 216 t.column "old_status_id", :integer, :default => 0, :null => false
189 217 t.column "new_status_id", :integer, :default => 0, :null => false
190 218 t.column "role_id", :integer, :default => 0, :null => false
191 219 end
192 220
193 221 # project
194 Permission.create :controller => "projects", :action => "show", :descr => "Overview", :sort => 100, :is_public => true
195 Permission.create :controller => "projects", :action => "changelog", :descr => "View change log", :sort => 105, :is_public => true
196 Permission.create :controller => "reports", :action => "issue_report", :descr => "View reports", :sort => 110, :is_public => true
197 Permission.create :controller => "projects", :action => "settings", :descr => "Settings", :sort => 150
198 Permission.create :controller => "projects", :action => "edit", :descr => "Edit", :sort => 151
222 Permission.create :controller => "projects", :action => "show", :description => "Overview", :sort => 100, :is_public => true
223 Permission.create :controller => "projects", :action => "changelog", :description => "View change log", :sort => 105, :is_public => true
224 Permission.create :controller => "reports", :action => "issue_report", :description => "View reports", :sort => 110, :is_public => true
225 Permission.create :controller => "projects", :action => "settings", :description => "Settings", :sort => 150
226 Permission.create :controller => "projects", :action => "edit", :description => "Edit", :sort => 151
199 227 # members
200 Permission.create :controller => "projects", :action => "list_members", :descr => "View list", :sort => 200, :is_public => true
201 Permission.create :controller => "projects", :action => "add_member", :descr => "New member", :sort => 220
202 Permission.create :controller => "members", :action => "edit", :descr => "Edit", :sort => 221
203 Permission.create :controller => "members", :action => "destroy", :descr => "Delete", :sort => 222
228 Permission.create :controller => "projects", :action => "list_members", :description => "View list", :sort => 200, :is_public => true
229 Permission.create :controller => "projects", :action => "add_member", :description => "New member", :sort => 220
230 Permission.create :controller => "members", :action => "edit", :description => "Edit", :sort => 221
231 Permission.create :controller => "members", :action => "destroy", :description => "Delete", :sort => 222
204 232 # versions
205 Permission.create :controller => "projects", :action => "add_version", :descr => "New version", :sort => 320
206 Permission.create :controller => "versions", :action => "edit", :descr => "Edit", :sort => 321
207 Permission.create :controller => "versions", :action => "destroy", :descr => "Delete", :sort => 322
233 Permission.create :controller => "projects", :action => "add_version", :description => "New version", :sort => 320
234 Permission.create :controller => "versions", :action => "edit", :description => "Edit", :sort => 321
235 Permission.create :controller => "versions", :action => "destroy", :description => "Delete", :sort => 322
208 236 # issue categories
209 Permission.create :controller => "projects", :action => "add_issue_category", :descr => "New issue category", :sort => 420
210 Permission.create :controller => "issue_categories", :action => "edit", :descr => "Edit", :sort => 421
211 Permission.create :controller => "issue_categories", :action => "destroy", :descr => "Delete", :sort => 422
237 Permission.create :controller => "projects", :action => "add_issue_category", :description => "New issue category", :sort => 420
238 Permission.create :controller => "issue_categories", :action => "edit", :description => "Edit", :sort => 421
239 Permission.create :controller => "issue_categories", :action => "destroy", :description => "Delete", :sort => 422
212 240 # issues
213 Permission.create :controller => "projects", :action => "list_issues", :descr => "View list", :sort => 1000, :is_public => true
214 Permission.create :controller => "issues", :action => "show", :descr => "View", :sort => 1005, :is_public => true
215 Permission.create :controller => "issues", :action => "download", :descr => "Download file", :sort => 1010, :is_public => true
216 Permission.create :controller => "projects", :action => "add_issue", :descr => "Report an issue", :sort => 1050, :mail_option => 1, :mail_enabled => 1
217 Permission.create :controller => "issues", :action => "edit", :descr => "Edit", :sort => 1055
218 Permission.create :controller => "issues", :action => "change_status", :descr => "Change status", :sort => 1060, :mail_option => 1, :mail_enabled => 1
219 Permission.create :controller => "issues", :action => "destroy", :descr => "Delete", :sort => 1065
220 Permission.create :controller => "issues", :action => "add_attachment", :descr => "Add file", :sort => 1070
221 Permission.create :controller => "issues", :action => "destroy_attachment", :descr => "Delete file", :sort => 1075
241 Permission.create :controller => "projects", :action => "list_issues", :description => "View list", :sort => 1000, :is_public => true
242 Permission.create :controller => "projects", :action => "export_issues_csv", :description => "Export list to CSV", :sort => 1001, :is_public => true
243 Permission.create :controller => "issues", :action => "show", :description => "View", :sort => 1005, :is_public => true
244 Permission.create :controller => "issues", :action => "download", :description => "Download file", :sort => 1010, :is_public => true
245 Permission.create :controller => "projects", :action => "add_issue", :description => "Report an issue", :sort => 1050, :mail_option => 1, :mail_enabled => 1
246 Permission.create :controller => "issues", :action => "edit", :description => "Edit", :sort => 1055
247 Permission.create :controller => "issues", :action => "change_status", :description => "Change status", :sort => 1060, :mail_option => 1, :mail_enabled => 1
248 Permission.create :controller => "issues", :action => "destroy", :description => "Delete", :sort => 1065
249 Permission.create :controller => "issues", :action => "add_attachment", :description => "Add file", :sort => 1070
250 Permission.create :controller => "issues", :action => "destroy_attachment", :description => "Delete file", :sort => 1075
222 251 # news
223 Permission.create :controller => "projects", :action => "list_news", :descr => "View list", :sort => 1100, :is_public => true
224 Permission.create :controller => "news", :action => "show", :descr => "View", :sort => 1101, :is_public => true
225 Permission.create :controller => "projects", :action => "add_news", :descr => "Add", :sort => 1120
226 Permission.create :controller => "news", :action => "edit", :descr => "Edit", :sort => 1121
227 Permission.create :controller => "news", :action => "destroy", :descr => "Delete", :sort => 1122
252 Permission.create :controller => "projects", :action => "list_news", :description => "View list", :sort => 1100, :is_public => true
253 Permission.create :controller => "news", :action => "show", :description => "View", :sort => 1101, :is_public => true
254 Permission.create :controller => "projects", :action => "add_news", :description => "Add", :sort => 1120
255 Permission.create :controller => "news", :action => "edit", :description => "Edit", :sort => 1121
256 Permission.create :controller => "news", :action => "destroy", :description => "Delete", :sort => 1122
228 257 # documents
229 Permission.create :controller => "projects", :action => "list_documents", :descr => "View list", :sort => 1200, :is_public => true
230 Permission.create :controller => "documents", :action => "show", :descr => "View", :sort => 1201, :is_public => true
231 Permission.create :controller => "documents", :action => "download", :descr => "Download", :sort => 1202, :is_public => true
232 Permission.create :controller => "projects", :action => "add_document", :descr => "Add", :sort => 1220
233 Permission.create :controller => "documents", :action => "edit", :descr => "Edit", :sort => 1221
234 Permission.create :controller => "documents", :action => "destroy", :descr => "Delete", :sort => 1222
235 Permission.create :controller => "documents", :action => "add_attachment", :descr => "Add file", :sort => 1223
236 Permission.create :controller => "documents", :action => "destroy_attachment", :descr => "Delete file", :sort => 1224
258 Permission.create :controller => "projects", :action => "list_documents", :description => "View list", :sort => 1200, :is_public => true
259 Permission.create :controller => "documents", :action => "show", :description => "View", :sort => 1201, :is_public => true
260 Permission.create :controller => "documents", :action => "download", :description => "Download", :sort => 1202, :is_public => true
261 Permission.create :controller => "projects", :action => "add_document", :description => "Add", :sort => 1220
262 Permission.create :controller => "documents", :action => "edit", :description => "Edit", :sort => 1221
263 Permission.create :controller => "documents", :action => "destroy", :description => "Delete", :sort => 1222
264 Permission.create :controller => "documents", :action => "add_attachment", :description => "Add file", :sort => 1223
265 Permission.create :controller => "documents", :action => "destroy_attachment", :description => "Delete file", :sort => 1224
237 266 # files
238 Permission.create :controller => "projects", :action => "list_files", :descr => "View list", :sort => 1300, :is_public => true
239 Permission.create :controller => "versions", :action => "download", :descr => "Download", :sort => 1301, :is_public => true
240 Permission.create :controller => "projects", :action => "add_file", :descr => "Add", :sort => 1320
241 Permission.create :controller => "versions", :action => "destroy_file", :descr => "Delete", :sort => 1322
267 Permission.create :controller => "projects", :action => "list_files", :description => "View list", :sort => 1300, :is_public => true
268 Permission.create :controller => "versions", :action => "download", :description => "Download", :sort => 1301, :is_public => true
269 Permission.create :controller => "projects", :action => "add_file", :description => "Add", :sort => 1320
270 Permission.create :controller => "versions", :action => "destroy_file", :description => "Delete", :sort => 1322
242 271
243 272 # create default administrator account
244 273 user = User.create :firstname => "redMine", :lastname => "Admin", :mail => "admin@somenet.foo", :mail_notification => true, :language => "en"
245 274 user.login = "admin"
246 275 user.password = "admin"
247 276 user.admin = true
248 277 user.save
249 278
250 279
251 280 end
252 281
253 282 def self.down
254 drop_table :attachments
283 drop_table :attachments
284 drop_table :auth_sources
255 285 drop_table :custom_fields
256 drop_table :custom_fields_projects
286 drop_table :custom_fields_projects
287 drop_table :custom_fields_trackers
257 288 drop_table :custom_values
258 289 drop_table :documents
259 290 drop_table :enumerations
260 291 drop_table :issue_categories
261 292 drop_table :issue_histories
262 293 drop_table :issue_statuses
263 294 drop_table :issues
264 295 drop_table :members
265 296 drop_table :news
266 297 drop_table :permissions
267 298 drop_table :permissions_roles
268 299 drop_table :projects
269 300 drop_table :roles
270 301 drop_table :trackers
302 drop_table :tokens
271 303 drop_table :users
272 304 drop_table :versions
273 305 drop_table :workflows
274 306 end
275 307 end
General Comments 0
You need to be logged in to leave comments. Login now