From 543a199c5f4720ebc0b9fe262b0e1655f902d577 Mon Sep 17 00:00:00 2001 From: fanqiang <316257774@qq.com> Date: Mon, 19 May 2014 15:40:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E5=BC=A0=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E8=A1=A8relative=5Fmemo=5Fto=5Fopen=5Fsource=5Fprojec?= =?UTF-8?q?ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/relative_memo.rb | 2 +- .../relative_memo_to_open_source_project.rb | 3 +++ ...40515013449_add_author_to_relative_memo.rb | 2 +- ...e_relative_memo_to_open_source_projects.rb | 10 +++++++ db/schema.rb | 26 ++++++++++++------- .../relative_memo_to_open_source_projects.yml | 11 ++++++++ ...lative_memo_to_open_source_project_test.rb | 7 +++++ 7 files changed, 49 insertions(+), 12 deletions(-) create mode 100644 app/models/relative_memo_to_open_source_project.rb create mode 100644 db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb create mode 100644 test/fixtures/relative_memo_to_open_source_projects.yml create mode 100644 test/unit/relative_memo_to_open_source_project_test.rb diff --git a/app/models/relative_memo.rb b/app/models/relative_memo.rb index 24504241e..ba7974da3 100644 --- a/app/models/relative_memo.rb +++ b/app/models/relative_memo.rb @@ -12,7 +12,7 @@ class RelativeMemo < ActiveRecord::Base acts_as_taggable acts_as_attachable - validates_presence_of :osp_id, :subject + validates_presence_of :subject #validates :content, presence: true # validates_length_of :subject, maximum: 50 #validates_length_of :content, maximum: 3072 diff --git a/app/models/relative_memo_to_open_source_project.rb b/app/models/relative_memo_to_open_source_project.rb new file mode 100644 index 000000000..5dd00338c --- /dev/null +++ b/app/models/relative_memo_to_open_source_project.rb @@ -0,0 +1,3 @@ +class RelativeMemoToOpenSourceProject < ActiveRecord::Base + # attr_accessible :title, :body +end diff --git a/db/migrate/20140515013449_add_author_to_relative_memo.rb b/db/migrate/20140515013449_add_author_to_relative_memo.rb index 96f83f2c0..ba097ac4c 100644 --- a/db/migrate/20140515013449_add_author_to_relative_memo.rb +++ b/db/migrate/20140515013449_add_author_to_relative_memo.rb @@ -2,6 +2,6 @@ class AddAuthorToRelativeMemo < ActiveRecord::Migration def change add_column :relative_memos, :username, :string add_column :relative_memos, :userhomeurl, :string - add_column :relative_memos, :date_collected, :datetime + add_column :relative_memos, :date_collected, :date end end diff --git a/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb b/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb new file mode 100644 index 000000000..492577c6c --- /dev/null +++ b/db/migrate/20140516031200_create_relative_memo_to_open_source_projects.rb @@ -0,0 +1,10 @@ +class CreateRelativeMemoToOpenSourceProjects < ActiveRecord::Migration + def change + create_table :relative_memo_to_open_source_projects do |t| + t.integer :osp_id + t.integer :relative_memo_id + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index b5cabfa7f..94206f0d4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140513073801) do +ActiveRecord::Schema.define(:version => 20140516031200) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -52,14 +52,11 @@ ActiveRecord::Schema.define(:version => 20140513073801) do add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type" add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on" - create_table "attachmentstypes", :id => false, :force => true do |t| - t.integer "id", :null => false - t.integer "typeId" + create_table "attachmentstypes", :force => true do |t| + t.integer "typeId", :null => false t.string "typeName", :limit => 50 end - add_index "attachmentstypes", ["id"], :name => "id" - create_table "auth_sources", :force => true do |t| t.string "type", :limit => 30, :default => "", :null => false t.string "name", :limit => 60, :default => "", :null => false @@ -652,6 +649,13 @@ ActiveRecord::Schema.define(:version => 20140513073801) do add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + create_table "relative_memo_to_open_source_projects", :force => true do |t| + t.integer "osp_id" + t.integer "relative_memo_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "relative_memos", :force => true do |t| t.integer "osp_id", :null => false t.integer "parent_id" @@ -668,6 +672,9 @@ ActiveRecord::Schema.define(:version => 20140513073801) do t.integer "viewed_count_crawl", :default => 0 t.integer "viewed_count_local", :default => 0 t.string "url" + t.string "username" + t.string "userhomeurl" + t.date "date_collected" end create_table "repositories", :force => true do |t| @@ -736,11 +743,10 @@ ActiveRecord::Schema.define(:version => 20140513073801) do t.string "url" t.string "title" t.integer "share_type" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + 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 "softapplications", :force => true do |t| @@ -843,8 +849,8 @@ ActiveRecord::Schema.define(:version => 20140513073801) do t.integer "zip_code" t.datetime "created_at", :null => false t.datetime "updated_at", :null => false - t.string "technical_title" t.integer "identity" + t.string "technical_title" t.string "student_id" t.string "teacher_realname" t.string "student_realname" diff --git a/test/fixtures/relative_memo_to_open_source_projects.yml b/test/fixtures/relative_memo_to_open_source_projects.yml new file mode 100644 index 000000000..c63aac0b6 --- /dev/null +++ b/test/fixtures/relative_memo_to_open_source_projects.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/unit/relative_memo_to_open_source_project_test.rb b/test/unit/relative_memo_to_open_source_project_test.rb new file mode 100644 index 000000000..f3ba567b0 --- /dev/null +++ b/test/unit/relative_memo_to_open_source_project_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class RelativeMemoToOpenSourceProjectTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end