@@ -1,26 +1,26 | |||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | class Setup < ActiveRecord::Migration | |
|
19 | ||
|
20 | class User < ActiveRecord::Base; end | |
|
21 | # model removed | |
|
22 | class Permission < ActiveRecord::Base; end | |
|
23 | ||
|
1 | # redMine - project management software | |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
|
3 | # | |
|
4 | # This program is free software; you can redistribute it and/or | |
|
5 | # modify it under the terms of the GNU General Public License | |
|
6 | # as published by the Free Software Foundation; either version 2 | |
|
7 | # of the License, or (at your option) any later version. | |
|
8 | # | |
|
9 | # This program is distributed in the hope that it will be useful, | |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
12 | # GNU General Public License for more details. | |
|
13 | # | |
|
14 | # You should have received a copy of the GNU General Public License | |
|
15 | # along with this program; if not, write to the Free Software | |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
|
17 | ||
|
18 | class Setup < ActiveRecord::Migration | |
|
19 | ||
|
20 | class User < ActiveRecord::Base; end | |
|
21 | # model removed | |
|
22 | class Permission < ActiveRecord::Base; end | |
|
23 | ||
|
24 | 24 | def self.up |
|
25 | 25 | create_table "attachments", :force => true do |t| |
|
26 | 26 | t.column "container_id", :integer, :default => 0, :null => false |
@@ -34,23 +34,23 class Setup < ActiveRecord::Migration | |||
|
34 | 34 | t.column "author_id", :integer, :default => 0, :null => false |
|
35 | 35 | t.column "created_on", :timestamp |
|
36 | 36 | end |
|
37 | ||
|
38 | create_table "auth_sources", :force => true do |t| | |
|
39 | t.column "type", :string, :limit => 30, :default => "", :null => false | |
|
40 | t.column "name", :string, :limit => 60, :default => "", :null => false | |
|
41 | t.column "host", :string, :limit => 60 | |
|
42 | t.column "port", :integer | |
|
43 | t.column "account", :string, :limit => 60 | |
|
44 | t.column "account_password", :string, :limit => 60 | |
|
45 | t.column "base_dn", :string, :limit => 255 | |
|
46 | t.column "attr_login", :string, :limit => 30 | |
|
47 | t.column "attr_firstname", :string, :limit => 30 | |
|
48 | t.column "attr_lastname", :string, :limit => 30 | |
|
49 | t.column "attr_mail", :string, :limit => 30 | |
|
50 | t.column "onthefly_register", :boolean, :default => false, :null => false | |
|
51 | end | |
|
37 | ||
|
38 | create_table "auth_sources", :force => true do |t| | |
|
39 | t.column "type", :string, :limit => 30, :default => "", :null => false | |
|
40 | t.column "name", :string, :limit => 60, :default => "", :null => false | |
|
41 | t.column "host", :string, :limit => 60 | |
|
42 | t.column "port", :integer | |
|
43 | t.column "account", :string, :limit => 60 | |
|
44 | t.column "account_password", :string, :limit => 60 | |
|
45 | t.column "base_dn", :string, :limit => 255 | |
|
46 | t.column "attr_login", :string, :limit => 30 | |
|
47 | t.column "attr_firstname", :string, :limit => 30 | |
|
48 | t.column "attr_lastname", :string, :limit => 30 | |
|
49 | t.column "attr_mail", :string, :limit => 30 | |
|
50 | t.column "onthefly_register", :boolean, :default => false, :null => false | |
|
51 | end | |
|
52 | 52 | |
|
53 | create_table "custom_fields", :force => true do |t| | |
|
53 | create_table "custom_fields", :force => true do |t| | |
|
54 | 54 | t.column "type", :string, :limit => 30, :default => "", :null => false |
|
55 | 55 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
56 | 56 | t.column "field_format", :string, :limit => 30, :default => "", :null => false |
@@ -58,23 +58,23 class Setup < ActiveRecord::Migration | |||
|
58 | 58 | t.column "regexp", :string, :default => "" |
|
59 | 59 | t.column "min_length", :integer, :default => 0, :null => false |
|
60 | 60 | t.column "max_length", :integer, :default => 0, :null => false |
|
61 | t.column "is_required", :boolean, :default => false, :null => false | |
|
62 | t.column "is_for_all", :boolean, :default => false, :null => false | |
|
61 | t.column "is_required", :boolean, :default => false, :null => false | |
|
62 | t.column "is_for_all", :boolean, :default => false, :null => false | |
|
63 | 63 | end |
|
64 | 64 | |
|
65 | 65 | create_table "custom_fields_projects", :id => false, :force => true do |t| |
|
66 | 66 | t.column "custom_field_id", :integer, :default => 0, :null => false |
|
67 | 67 | t.column "project_id", :integer, :default => 0, :null => false |
|
68 | 68 | end |
|
69 | ||
|
70 | create_table "custom_fields_trackers", :id => false, :force => true do |t| | |
|
71 | t.column "custom_field_id", :integer, :default => 0, :null => false | |
|
72 | t.column "tracker_id", :integer, :default => 0, :null => false | |
|
73 | end | |
|
69 | ||
|
70 | create_table "custom_fields_trackers", :id => false, :force => true do |t| | |
|
71 | t.column "custom_field_id", :integer, :default => 0, :null => false | |
|
72 | t.column "tracker_id", :integer, :default => 0, :null => false | |
|
73 | end | |
|
74 | 74 | |
|
75 | 75 | create_table "custom_values", :force => true do |t| |
|
76 | t.column "customized_type", :string, :limit => 30, :default => "", :null => false | |
|
77 | t.column "customized_id", :integer, :default => 0, :null => false | |
|
76 | t.column "customized_type", :string, :limit => 30, :default => "", :null => false | |
|
77 | t.column "customized_id", :integer, :default => 0, :null => false | |
|
78 | 78 | t.column "custom_field_id", :integer, :default => 0, :null => false |
|
79 | 79 | t.column "value", :text |
|
80 | 80 | end |
@@ -85,8 +85,8 class Setup < ActiveRecord::Migration | |||
|
85 | 85 | t.column "title", :string, :limit => 60, :default => "", :null => false |
|
86 | 86 | t.column "description", :text |
|
87 | 87 | t.column "created_on", :timestamp |
|
88 | end | |
|
89 | ||
|
88 | end | |
|
89 | ||
|
90 | 90 | add_index "documents", ["project_id"], :name => "documents_project_id" |
|
91 | 91 | |
|
92 | 92 | create_table "enumerations", :force => true do |t| |
@@ -97,8 +97,8 class Setup < ActiveRecord::Migration | |||
|
97 | 97 | create_table "issue_categories", :force => true do |t| |
|
98 | 98 | t.column "project_id", :integer, :default => 0, :null => false |
|
99 | 99 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
100 | end | |
|
101 | ||
|
100 | end | |
|
101 | ||
|
102 | 102 | add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" |
|
103 | 103 | |
|
104 | 104 | create_table "issue_histories", :force => true do |t| |
@@ -122,14 +122,14 class Setup < ActiveRecord::Migration | |||
|
122 | 122 | t.column "tracker_id", :integer, :default => 0, :null => false |
|
123 | 123 | t.column "project_id", :integer, :default => 0, :null => false |
|
124 | 124 | t.column "subject", :string, :default => "", :null => false |
|
125 | t.column "description", :text | |
|
125 | t.column "description", :text | |
|
126 | 126 | t.column "due_date", :date |
|
127 | 127 | t.column "category_id", :integer |
|
128 | 128 | t.column "status_id", :integer, :default => 0, :null => false |
|
129 | 129 | t.column "assigned_to_id", :integer |
|
130 | 130 | t.column "priority_id", :integer, :default => 0, :null => false |
|
131 | 131 | t.column "fixed_version_id", :integer |
|
132 | t.column "author_id", :integer, :default => 0, :null => false | |
|
132 | t.column "author_id", :integer, :default => 0, :null => false | |
|
133 | 133 | t.column "lock_version", :integer, :default => 0, :null => false |
|
134 | 134 | t.column "created_on", :timestamp |
|
135 | 135 | t.column "updated_on", :timestamp |
@@ -151,8 +151,8 class Setup < ActiveRecord::Migration | |||
|
151 | 151 | t.column "description", :text |
|
152 | 152 | t.column "author_id", :integer, :default => 0, :null => false |
|
153 | 153 | t.column "created_on", :timestamp |
|
154 | end | |
|
155 | ||
|
154 | end | |
|
155 | ||
|
156 | 156 | add_index "news", ["project_id"], :name => "news_project_id" |
|
157 | 157 | |
|
158 | 158 | create_table "permissions", :force => true do |t| |
@@ -176,8 +176,8 class Setup < ActiveRecord::Migration | |||
|
176 | 176 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
177 | 177 | t.column "description", :string, :default => "", :null => false |
|
178 | 178 | t.column "homepage", :string, :limit => 60, :default => "" |
|
179 | t.column "is_public", :boolean, :default => true, :null => false | |
|
180 | t.column "parent_id", :integer | |
|
179 | t.column "is_public", :boolean, :default => true, :null => false | |
|
180 | t.column "parent_id", :integer | |
|
181 | 181 | t.column "projects_count", :integer, :default => 0 |
|
182 | 182 | t.column "created_on", :timestamp |
|
183 | 183 | t.column "updated_on", :timestamp |
@@ -186,13 +186,13 class Setup < ActiveRecord::Migration | |||
|
186 | 186 | create_table "roles", :force => true do |t| |
|
187 | 187 | t.column "name", :string, :limit => 30, :default => "", :null => false |
|
188 | 188 | end |
|
189 | ||
|
190 | create_table "tokens", :force => true do |t| | |
|
191 | t.column "user_id", :integer, :default => 0, :null => false | |
|
192 | t.column "action", :string, :limit => 30, :default => "", :null => false | |
|
193 | t.column "value", :string, :limit => 40, :default => "", :null => false | |
|
194 | t.column "created_on", :datetime, :null => false | |
|
195 | end | |
|
189 | ||
|
190 | create_table "tokens", :force => true do |t| | |
|
191 | t.column "user_id", :integer, :default => 0, :null => false | |
|
192 | t.column "action", :string, :limit => 30, :default => "", :null => false | |
|
193 | t.column "value", :string, :limit => 40, :default => "", :null => false | |
|
194 | t.column "created_on", :datetime, :null => false | |
|
195 | end | |
|
196 | 196 | |
|
197 | 197 | create_table "trackers", :force => true do |t| |
|
198 | 198 | t.column "name", :string, :limit => 30, :default => "", :null => false |
@@ -209,7 +209,7 class Setup < ActiveRecord::Migration | |||
|
209 | 209 | t.column "admin", :boolean, :default => false, :null => false |
|
210 | 210 | t.column "status", :integer, :default => 1, :null => false |
|
211 | 211 | t.column "last_login_on", :datetime |
|
212 | t.column "language", :string, :limit => 2, :default => "" | |
|
212 | t.column "language", :string, :limit => 2, :default => "" | |
|
213 | 213 | t.column "auth_source_id", :integer |
|
214 | 214 | t.column "created_on", :timestamp |
|
215 | 215 | t.column "updated_on", :timestamp |
@@ -222,8 +222,8 class Setup < ActiveRecord::Migration | |||
|
222 | 222 | t.column "effective_date", :date |
|
223 | 223 | t.column "created_on", :timestamp |
|
224 | 224 | t.column "updated_on", :timestamp |
|
225 | end | |
|
226 | ||
|
225 | end | |
|
226 | ||
|
227 | 227 | add_index "versions", ["project_id"], :name => "versions_project_id" |
|
228 | 228 | |
|
229 | 229 | create_table "workflows", :force => true do |t| |
@@ -254,7 +254,7 class Setup < ActiveRecord::Migration | |||
|
254 | 254 | Permission.create :controller => "issue_categories", :action => "destroy", :description => "button_delete", :sort => 422 |
|
255 | 255 | # issues |
|
256 | 256 | Permission.create :controller => "projects", :action => "list_issues", :description => "button_list", :sort => 1000, :is_public => true |
|
257 | Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true | |
|
257 | Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true | |
|
258 | 258 | Permission.create :controller => "issues", :action => "show", :description => "button_view", :sort => 1005, :is_public => true |
|
259 | 259 | Permission.create :controller => "issues", :action => "download", :description => "button_download", :sort => 1010, :is_public => true |
|
260 | 260 | Permission.create :controller => "projects", :action => "add_issue", :description => "button_add", :sort => 1050, :mail_option => 1, :mail_enabled => 1 |
@@ -269,7 +269,7 class Setup < ActiveRecord::Migration | |||
|
269 | 269 | Permission.create :controller => "projects", :action => "add_news", :description => "button_add", :sort => 1120 |
|
270 | 270 | Permission.create :controller => "news", :action => "edit", :description => "button_edit", :sort => 1121 |
|
271 | 271 | Permission.create :controller => "news", :action => "destroy", :description => "button_delete", :sort => 1122 |
|
272 | # documents | |
|
272 | # documents | |
|
273 | 273 | Permission.create :controller => "projects", :action => "list_documents", :description => "button_list", :sort => 1200, :is_public => true |
|
274 | 274 | Permission.create :controller => "documents", :action => "show", :description => "button_view", :sort => 1201, :is_public => true |
|
275 | 275 | Permission.create :controller => "documents", :action => "download", :description => "button_download", :sort => 1202, :is_public => true |
@@ -285,22 +285,22 class Setup < ActiveRecord::Migration | |||
|
285 | 285 | Permission.create :controller => "versions", :action => "destroy_file", :description => "button_delete", :sort => 1322 |
|
286 | 286 | |
|
287 | 287 | # create default administrator account |
|
288 | user = User.create :login => "admin", | |
|
289 | :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", | |
|
290 | :admin => true, | |
|
291 | :firstname => "Redmine", | |
|
292 | :lastname => "Admin", | |
|
293 | :mail => "admin@example.net", | |
|
294 | :mail_notification => true, | |
|
295 | :language => "en", | |
|
296 | :status => 1 | |
|
297 | end | |
|
298 | ||
|
288 | user = User.create :login => "admin", | |
|
289 | :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", | |
|
290 | :admin => true, | |
|
291 | :firstname => "Redmine", | |
|
292 | :lastname => "Admin", | |
|
293 | :mail => "admin@example.net", | |
|
294 | :mail_notification => true, | |
|
295 | :language => "en", | |
|
296 | :status => 1 | |
|
297 | end | |
|
298 | ||
|
299 | 299 | def self.down |
|
300 | drop_table :attachments | |
|
300 | drop_table :attachments | |
|
301 | 301 | drop_table :auth_sources |
|
302 | 302 | drop_table :custom_fields |
|
303 | drop_table :custom_fields_projects | |
|
303 | drop_table :custom_fields_projects | |
|
304 | 304 | drop_table :custom_fields_trackers |
|
305 | 305 | drop_table :custom_values |
|
306 | 306 | drop_table :documents |
@@ -316,9 +316,9 class Setup < ActiveRecord::Migration | |||
|
316 | 316 | drop_table :projects |
|
317 | 317 | drop_table :roles |
|
318 | 318 | drop_table :trackers |
|
319 | drop_table :tokens | |
|
319 | drop_table :tokens | |
|
320 | 320 | drop_table :users |
|
321 | 321 | drop_table :versions |
|
322 | drop_table :workflows | |
|
323 | end | |
|
324 | end | |
|
322 | drop_table :workflows | |
|
323 | end | |
|
324 | end |
General Comments 0
You need to be logged in to leave comments.
Login now