diff --git a/db/migrate/001_setup.rb b/db/migrate/001_setup.rb index d49e0e444..c0ebbf8d2 100644 --- a/db/migrate/001_setup.rb +++ b/db/migrate/001_setup.rb @@ -1,26 +1,26 @@ -# redMine - project management software -# Copyright (C) 2006 Jean-Philippe Lang -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class Setup < ActiveRecord::Migration - - class User < ActiveRecord::Base; end - # model removed - class Permission < ActiveRecord::Base; end - +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class Setup < ActiveRecord::Migration + + class User < ActiveRecord::Base; end + # model removed + class Permission < ActiveRecord::Base; end + def self.up create_table "attachments", :force => true do |t| t.column "container_id", :integer, :default => 0, :null => false @@ -34,23 +34,23 @@ class Setup < ActiveRecord::Migration t.column "author_id", :integer, :default => 0, :null => false t.column "created_on", :timestamp end - - create_table "auth_sources", :force => true do |t| - t.column "type", :string, :limit => 30, :default => "", :null => false - t.column "name", :string, :limit => 60, :default => "", :null => false - t.column "host", :string, :limit => 60 - t.column "port", :integer - t.column "account", :string, :limit => 60 - t.column "account_password", :string, :limit => 60 - t.column "base_dn", :string, :limit => 255 - t.column "attr_login", :string, :limit => 30 - t.column "attr_firstname", :string, :limit => 30 - t.column "attr_lastname", :string, :limit => 30 - t.column "attr_mail", :string, :limit => 30 - t.column "onthefly_register", :boolean, :default => false, :null => false - end + + create_table "auth_sources", :force => true do |t| + t.column "type", :string, :limit => 30, :default => "", :null => false + t.column "name", :string, :limit => 60, :default => "", :null => false + t.column "host", :string, :limit => 60 + t.column "port", :integer + t.column "account", :string, :limit => 60 + t.column "account_password", :string, :limit => 60 + t.column "base_dn", :string, :limit => 255 + t.column "attr_login", :string, :limit => 30 + t.column "attr_firstname", :string, :limit => 30 + t.column "attr_lastname", :string, :limit => 30 + t.column "attr_mail", :string, :limit => 30 + t.column "onthefly_register", :boolean, :default => false, :null => false + end - create_table "custom_fields", :force => true do |t| + create_table "custom_fields", :force => true do |t| t.column "type", :string, :limit => 30, :default => "", :null => false t.column "name", :string, :limit => 30, :default => "", :null => false t.column "field_format", :string, :limit => 30, :default => "", :null => false @@ -58,23 +58,23 @@ class Setup < ActiveRecord::Migration t.column "regexp", :string, :default => "" t.column "min_length", :integer, :default => 0, :null => false t.column "max_length", :integer, :default => 0, :null => false - t.column "is_required", :boolean, :default => false, :null => false - t.column "is_for_all", :boolean, :default => false, :null => false + t.column "is_required", :boolean, :default => false, :null => false + t.column "is_for_all", :boolean, :default => false, :null => false end create_table "custom_fields_projects", :id => false, :force => true do |t| t.column "custom_field_id", :integer, :default => 0, :null => false t.column "project_id", :integer, :default => 0, :null => false end - - create_table "custom_fields_trackers", :id => false, :force => true do |t| - t.column "custom_field_id", :integer, :default => 0, :null => false - t.column "tracker_id", :integer, :default => 0, :null => false - end + + create_table "custom_fields_trackers", :id => false, :force => true do |t| + t.column "custom_field_id", :integer, :default => 0, :null => false + t.column "tracker_id", :integer, :default => 0, :null => false + end create_table "custom_values", :force => true do |t| - t.column "customized_type", :string, :limit => 30, :default => "", :null => false - t.column "customized_id", :integer, :default => 0, :null => false + t.column "customized_type", :string, :limit => 30, :default => "", :null => false + t.column "customized_id", :integer, :default => 0, :null => false t.column "custom_field_id", :integer, :default => 0, :null => false t.column "value", :text end @@ -85,8 +85,8 @@ class Setup < ActiveRecord::Migration t.column "title", :string, :limit => 60, :default => "", :null => false t.column "description", :text t.column "created_on", :timestamp - end - + end + add_index "documents", ["project_id"], :name => "documents_project_id" create_table "enumerations", :force => true do |t| @@ -97,8 +97,8 @@ class Setup < ActiveRecord::Migration create_table "issue_categories", :force => true do |t| t.column "project_id", :integer, :default => 0, :null => false t.column "name", :string, :limit => 30, :default => "", :null => false - end - + end + add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" create_table "issue_histories", :force => true do |t| @@ -122,14 +122,14 @@ class Setup < ActiveRecord::Migration t.column "tracker_id", :integer, :default => 0, :null => false t.column "project_id", :integer, :default => 0, :null => false t.column "subject", :string, :default => "", :null => false - t.column "description", :text + t.column "description", :text t.column "due_date", :date t.column "category_id", :integer t.column "status_id", :integer, :default => 0, :null => false t.column "assigned_to_id", :integer t.column "priority_id", :integer, :default => 0, :null => false t.column "fixed_version_id", :integer - t.column "author_id", :integer, :default => 0, :null => false + t.column "author_id", :integer, :default => 0, :null => false t.column "lock_version", :integer, :default => 0, :null => false t.column "created_on", :timestamp t.column "updated_on", :timestamp @@ -151,8 +151,8 @@ class Setup < ActiveRecord::Migration t.column "description", :text t.column "author_id", :integer, :default => 0, :null => false t.column "created_on", :timestamp - end - + end + add_index "news", ["project_id"], :name => "news_project_id" create_table "permissions", :force => true do |t| @@ -176,8 +176,8 @@ class Setup < ActiveRecord::Migration t.column "name", :string, :limit => 30, :default => "", :null => false t.column "description", :string, :default => "", :null => false t.column "homepage", :string, :limit => 60, :default => "" - t.column "is_public", :boolean, :default => true, :null => false - t.column "parent_id", :integer + t.column "is_public", :boolean, :default => true, :null => false + t.column "parent_id", :integer t.column "projects_count", :integer, :default => 0 t.column "created_on", :timestamp t.column "updated_on", :timestamp @@ -186,13 +186,13 @@ class Setup < ActiveRecord::Migration create_table "roles", :force => true do |t| t.column "name", :string, :limit => 30, :default => "", :null => false end - - create_table "tokens", :force => true do |t| - t.column "user_id", :integer, :default => 0, :null => false - t.column "action", :string, :limit => 30, :default => "", :null => false - t.column "value", :string, :limit => 40, :default => "", :null => false - t.column "created_on", :datetime, :null => false - end + + create_table "tokens", :force => true do |t| + t.column "user_id", :integer, :default => 0, :null => false + t.column "action", :string, :limit => 30, :default => "", :null => false + t.column "value", :string, :limit => 40, :default => "", :null => false + t.column "created_on", :datetime, :null => false + end create_table "trackers", :force => true do |t| t.column "name", :string, :limit => 30, :default => "", :null => false @@ -209,7 +209,7 @@ class Setup < ActiveRecord::Migration t.column "admin", :boolean, :default => false, :null => false t.column "status", :integer, :default => 1, :null => false t.column "last_login_on", :datetime - t.column "language", :string, :limit => 2, :default => "" + t.column "language", :string, :limit => 2, :default => "" t.column "auth_source_id", :integer t.column "created_on", :timestamp t.column "updated_on", :timestamp @@ -222,8 +222,8 @@ class Setup < ActiveRecord::Migration t.column "effective_date", :date t.column "created_on", :timestamp t.column "updated_on", :timestamp - end - + end + add_index "versions", ["project_id"], :name => "versions_project_id" create_table "workflows", :force => true do |t| @@ -254,7 +254,7 @@ class Setup < ActiveRecord::Migration Permission.create :controller => "issue_categories", :action => "destroy", :description => "button_delete", :sort => 422 # issues Permission.create :controller => "projects", :action => "list_issues", :description => "button_list", :sort => 1000, :is_public => true - Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true + Permission.create :controller => "projects", :action => "export_issues_csv", :description => "label_export_csv", :sort => 1001, :is_public => true Permission.create :controller => "issues", :action => "show", :description => "button_view", :sort => 1005, :is_public => true Permission.create :controller => "issues", :action => "download", :description => "button_download", :sort => 1010, :is_public => true 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 Permission.create :controller => "projects", :action => "add_news", :description => "button_add", :sort => 1120 Permission.create :controller => "news", :action => "edit", :description => "button_edit", :sort => 1121 Permission.create :controller => "news", :action => "destroy", :description => "button_delete", :sort => 1122 - # documents + # documents Permission.create :controller => "projects", :action => "list_documents", :description => "button_list", :sort => 1200, :is_public => true Permission.create :controller => "documents", :action => "show", :description => "button_view", :sort => 1201, :is_public => true Permission.create :controller => "documents", :action => "download", :description => "button_download", :sort => 1202, :is_public => true @@ -285,22 +285,22 @@ class Setup < ActiveRecord::Migration Permission.create :controller => "versions", :action => "destroy_file", :description => "button_delete", :sort => 1322 # create default administrator account - user = User.create :login => "admin", - :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", - :admin => true, - :firstname => "Redmine", - :lastname => "Admin", - :mail => "admin@example.net", - :mail_notification => true, - :language => "en", - :status => 1 - end - + user = User.create :login => "admin", + :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", + :admin => true, + :firstname => "Redmine", + :lastname => "Admin", + :mail => "admin@example.net", + :mail_notification => true, + :language => "en", + :status => 1 + end + def self.down - drop_table :attachments + drop_table :attachments drop_table :auth_sources drop_table :custom_fields - drop_table :custom_fields_projects + drop_table :custom_fields_projects drop_table :custom_fields_trackers drop_table :custom_values drop_table :documents @@ -316,9 +316,9 @@ class Setup < ActiveRecord::Migration drop_table :projects drop_table :roles drop_table :trackers - drop_table :tokens + drop_table :tokens drop_table :users drop_table :versions - drop_table :workflows - end -end + drop_table :workflows + end +end