添加一张连接表relative_memo_to_open_source_projects

This commit is contained in:
fanqiang 2014-05-19 15:40:53 +08:00
parent a07ae9be58
commit 543a199c5f
7 changed files with 49 additions and 12 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
class RelativeMemoToOpenSourceProject < ActiveRecord::Base
# attr_accessible :title, :body
end

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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

View File

@ -0,0 +1,7 @@
require 'test_helper'
class RelativeMemoToOpenSourceProjectTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end