From 2932f5a9401f6bc8b4e48bef6edffde85988f1fc Mon Sep 17 00:00:00 2001 From: yanxd Date: Sat, 16 Nov 2013 10:37:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1db:migrate=E6=97=B6?= =?UTF-8?q?=E5=88=9B=E5=BB=BAadmin=E7=9A=84=E7=94=A8=E6=88=B7=E6=89=A9?= =?UTF-8?q?=E5=B1=95=E8=A1=A8=EF=BC=8C=E9=98=B2=E6=AD=A2=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E9=83=A8=E7=BD=B2=E5=87=BA=E9=94=99;=E4=B8=BA?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=89=88=E6=9C=AC=E5=BA=93diff=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BF=87=E6=BB=A4=E5=99=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 2 +- db/migrate/001_setup.rb | 2 +- .../20130814084938_create_user_extensions.rb | 10 ++ db/schema.rb | 112 +++++++----------- 4 files changed, 52 insertions(+), 74 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index aa160acfd..e321f2dc4 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -36,7 +36,7 @@ class RepositoriesController < ApplicationController before_filter :authorize , :except => [:newrepo,:newcreate,:fork] accept_rss_auth :revisions # hidden repositories filter // 隐藏代码过滤器 - before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision ] + before_filter :check_hidden_repo, :only => [:show, :stats, :revisions, :revision, :diff ] rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed diff --git a/db/migrate/001_setup.rb b/db/migrate/001_setup.rb index f1b9c1ed4..dfe75f095 100644 --- a/db/migrate/001_setup.rb +++ b/db/migrate/001_setup.rb @@ -288,7 +288,7 @@ class Setup < ActiveRecord::Migration user = User.create :login => "admin", :hashed_password => "d033e22ae348aeb5660fc2140aec35850c4da997", :admin => true, - :firstname => "Redmine", + :firstname => "Trustie", :lastname => "Admin", :mail => "admin@example.net", :mail_notification => true, diff --git a/db/migrate/20130814084938_create_user_extensions.rb b/db/migrate/20130814084938_create_user_extensions.rb index f160bd52c..e535b2589 100644 --- a/db/migrate/20130814084938_create_user_extensions.rb +++ b/db/migrate/20130814084938_create_user_extensions.rb @@ -1,4 +1,6 @@ class CreateUserExtensions < ActiveRecord::Migration + class User < ActiveRecord::Base; end + class UserExtensions < ActiveRecord::Base; end def self.up create_table :user_extensions do |t| t.column :user_id,:integer,:null => false @@ -11,6 +13,14 @@ class CreateUserExtensions < ActiveRecord::Migration t.column :zip_code,:integer t.timestamps end + user = User.find_by_admin true + user_extensions = UserExtensions.create :user_id => user.id, + :birthday => nil, + :brief_introduction => "", + :gender => 1, + :location => "", + :occupation => nil, + :work_experience => nil end def self.down diff --git a/db/schema.rb b/db/schema.rb index 78af1a774..bced5ea86 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,15 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20131112005309) do - - create_table "a_user_watchers", :force => true do |t| - t.string "name" - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "member_id" - end +ActiveRecord::Schema.define(:version => 20131113124237) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -291,9 +283,9 @@ ActiveRecord::Schema.define(:version => 20131112005309) do add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id" create_table "issue_relations", :force => true do |t| - t.integer "issue_from_id", :null => false - t.integer "issue_to_id", :null => false - t.string "relation_type", :null => false + t.integer "issue_from_id", :null => false + t.integer "issue_to_id", :null => false + t.string "relation_type", :default => "", :null => false t.integer "delay" end @@ -442,22 +434,6 @@ ActiveRecord::Schema.define(:version => 20131112005309) do add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id" add_index "messages", ["parent_id"], :name => "messages_parent_id" - create_table "messages_for_bids", :force => true do |t| - t.string "message" - t.integer "user_id" - t.integer "bid_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - - create_table "messages_for_users", :force => true do |t| - t.integer "messager_id" - t.integer "user_id" - t.string "message" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "news", :force => true do |t| t.integer "project_id" t.string "title", :limit => 60, :default => "", :null => false @@ -517,22 +493,11 @@ ActiveRecord::Schema.define(:version => 20131112005309) do t.integer "watchers_count" t.integer "project_id" t.integer "project_type" - t.integer "gitlab_group_id", :limit => 8 - t.float "grade", :default => 0.0 - t.integer "course_ac_para", :default => 0 + t.float "grade", :default => 0.0 + t.integer "course_ac_para", :default => 0 end - add_index "project_statuses", ["changesets_count"], :name => "index_project_statuses_on_changesets_count" - add_index "project_statuses", ["watchers_count"], :name => "index_project_statuses_on_watchers_count" - - create_table "project_tags", :force => true do |t| - t.integer "project_id" - t.integer "tag_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "user_id" - end + add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade" create_table "projects", :force => true do |t| t.string "name", :default => "", :null => false @@ -578,18 +543,17 @@ ActiveRecord::Schema.define(:version => 20131112005309) do add_index "queries", ["user_id"], :name => "index_queries_on_user_id" create_table "repositories", :force => true do |t| - t.integer "project_id", :default => 0, :null => false - t.string "url", :default => "", :null => false - t.string "login", :limit => 60, :default => "" - t.string "password", :default => "" - t.string "root_url", :default => "" + t.integer "project_id", :default => 0, :null => false + t.string "url", :default => "", :null => false + t.string "login", :limit => 60, :default => "" + t.string "password", :default => "" + t.string "root_url", :default => "" t.string "type" - t.string "path_encoding", :limit => 64 - t.string "log_encoding", :limit => 64 + t.string "path_encoding", :limit => 64 + t.string "log_encoding", :limit => 64 t.text "extra_info" t.string "identifier" - t.boolean "is_default", :default => false - t.string "git_project_id" + t.boolean "is_default", :default => false end add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id" @@ -603,6 +567,26 @@ ActiveRecord::Schema.define(:version => 20131112005309) do t.string "issues_visibility", :limit => 30, :default => "default", :null => false end + create_table "seems_rateable_cached_ratings", :force => true do |t| + t.integer "cacheable_id", :limit => 8 + t.string "cacheable_type" + t.float "avg", :null => false + t.integer "cnt", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "seems_rateable_rates", :force => true do |t| + t.integer "rater_id", :limit => 8 + t.integer "rateable_id" + t.string "rateable_type" + t.float "stars", :null => false + t.string "dimension" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "settings", :force => true do |t| t.string "name", :default => "", :null => false t.text "value" @@ -613,20 +597,13 @@ ActiveRecord::Schema.define(:version => 20131112005309) do create_table "shares", :force => true do |t| t.date "created_on" - t.string "title" - t.string "share_type" t.string "url" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "project_id" - t.integer "user_id" - t.string "description" - end - - create_table "students", :force => true do |t| - t.string "name" + t.string "title" + t.integer "share_type" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "project_id" + t.integer "user_id" end create_table "students_for_courses", :force => true do |t| @@ -687,7 +664,7 @@ ActiveRecord::Schema.define(:version => 20131112005309) do create_table "tokens", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.string "action", :limit => 30, :default => "", :null => false - t.string "value", :limit => 40 + t.string "value", :limit => 40, :default => "", :null => false t.datetime "created_on", :null => false end @@ -719,7 +696,6 @@ ActiveRecord::Schema.define(:version => 20131112005309) do t.string "teacher_realname" t.string "student_realname" t.string "location_city" - t.string "git_token" end create_table "user_grades", :force => true do |t| @@ -756,14 +732,6 @@ ActiveRecord::Schema.define(:version => 20131112005309) do add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade" add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count" - create_table "user_tags", :force => true do |t| - t.integer "user_id" - t.integer "tag_id" - t.string "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "users", :force => true do |t| t.string "login", :default => "", :null => false t.string "hashed_password", :limit => 40, :default => "", :null => false