create the mission_candidate model

jamesperet 10 gadi atpakaļ
vecāks
revīzija
5f49552400

+ 4 - 0
app/models/mission_candidate.rb

@@ -0,0 +1,4 @@
1
+class MissionCandidate < ActiveRecord::Base
2
+  belongs_to :user
3
+  belongs_to :mission_agent
4
+end

+ 12 - 0
db/migrate/20150121040831_create_mission_candidates.rb

@@ -0,0 +1,12 @@
1
+class CreateMissionCandidates < ActiveRecord::Migration
2
+  def change
3
+    create_table :mission_candidates do |t|
4
+      t.references :user, index: true
5
+      t.references :mission_agent, index: true
6
+      t.integer :status
7
+      t.string :mode
8
+
9
+      t.timestamps
10
+    end
11
+  end
12
+end

+ 13 - 1
db/schema.rb

@@ -11,7 +11,7 @@
11 11
 #
12 12
 # It's strongly recommended that you check this file into your version control system.
13 13
 
14
-ActiveRecord::Schema.define(version: 20150121035726) do
14
+ActiveRecord::Schema.define(version: 20150121040831) do
15 15
 
16 16
   # These are extensions that must be enabled in order to support this database
17 17
   enable_extension "plpgsql"
@@ -106,6 +106,18 @@ ActiveRecord::Schema.define(version: 20150121035726) do
106 106
   add_index "mission_agents", ["mission_id"], name: "index_mission_agents_on_mission_id", using: :btree
107 107
   add_index "mission_agents", ["user_id"], name: "index_mission_agents_on_user_id", using: :btree
108 108
 
109
+  create_table "mission_candidates", force: true do |t|
110
+    t.integer  "user_id"
111
+    t.integer  "mission_agent_id"
112
+    t.integer  "status"
113
+    t.string   "mode"
114
+    t.datetime "created_at"
115
+    t.datetime "updated_at"
116
+  end
117
+
118
+  add_index "mission_candidates", ["mission_agent_id"], name: "index_mission_candidates_on_mission_agent_id", using: :btree
119
+  add_index "mission_candidates", ["user_id"], name: "index_mission_candidates_on_user_id", using: :btree
120
+
109 121
   create_table "missions", force: true do |t|
110 122
     t.integer  "mission_agents_id"
111 123
     t.string   "title"

+ 13 - 0
test/fixtures/mission_candidates.yml

@@ -0,0 +1,13 @@
1
+# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
+
3
+one:
4
+  user_id: 
5
+  mission_agent_id: 
6
+  status: 1
7
+  mode: MyString
8
+
9
+two:
10
+  user_id: 
11
+  mission_agent_id: 
12
+  status: 1
13
+  mode: MyString

+ 7 - 0
test/models/mission_candidate_test.rb

@@ -0,0 +1,7 @@
1
+require 'test_helper'
2
+
3
+class MissionCandidateTest < ActiveSupport::TestCase
4
+  # test "the truth" do
5
+  #   assert true
6
+  # end
7
+end