Adds poll partial result

This commit is contained in:
kikito
2016-11-11 19:08:15 +01:00
parent 4db6ae489f
commit 3ce7f671fb
2 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
class CreatePollPartialResult < ActiveRecord::Migration
def change
create_table :poll_partial_results do |t|
t.integer :question_id, index: true
t.integer :author_id, index: true
t.string :answer, index: true
t.integer :amount
t.string :origin, index: true
end
add_foreign_key(:poll_partial_results, :users, column: :author_id)
add_foreign_key(:poll_partial_results, :poll_questions, column: :question_id)
end
end

View File

@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161107124207) do
ActiveRecord::Schema.define(version: 20161107174423) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -295,6 +295,19 @@ ActiveRecord::Schema.define(version: 20161107124207) do
t.datetime "updated_at", null: false
end
create_table "poll_partial_results", force: :cascade do |t|
t.integer "question_id"
t.integer "author_id"
t.string "answer"
t.integer "amount"
t.string "origin"
end
add_index "poll_partial_results", ["answer"], name: "index_poll_partial_results_on_answer", using: :btree
add_index "poll_partial_results", ["author_id"], name: "index_poll_partial_results_on_author_id", using: :btree
add_index "poll_partial_results", ["origin"], name: "index_poll_partial_results_on_origin", using: :btree
add_index "poll_partial_results", ["question_id"], name: "index_poll_partial_results_on_question_id", using: :btree
create_table "poll_questions", force: :cascade do |t|
t.integer "proposal_id"
t.integer "poll_id"
@@ -620,6 +633,8 @@ ActiveRecord::Schema.define(version: 20161107124207) do
add_foreign_key "moderators", "users"
add_foreign_key "notifications", "users"
add_foreign_key "organizations", "users"
add_foreign_key "poll_partial_results", "poll_questions", column: "question_id"
add_foreign_key "poll_partial_results", "users", column: "author_id"
add_foreign_key "poll_questions", "polls"
add_foreign_key "poll_questions", "proposals"
add_foreign_key "poll_questions", "users", column: "author_id"