Skip to content

Commit

Permalink
Add migration to create questions
Browse files Browse the repository at this point in the history
  • Loading branch information
acamino committed Mar 24, 2016
1 parent fe40005 commit 35059eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions db/migrate/20160324145530_create_questions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class CreateQuestions < ActiveRecord::Migration
def change
create_table :questions do |t|
t.references :survey, null: false, index: true
t.string :body, null: false
t.integer :type, null: false, default: 0, index: true
t.timestamps null: false
end

add_foreign_key :questions, :surveys
end
end
14 changes: 13 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,27 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20160324144643) do
ActiveRecord::Schema.define(version: 20160324145530) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "questions", force: :cascade do |t|
t.integer "survey_id", null: false
t.string "body", null: false
t.integer "type", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_index "questions", ["survey_id"], name: "index_questions_on_survey_id", using: :btree
add_index "questions", ["type"], name: "index_questions_on_type", using: :btree

create_table "surveys", force: :cascade do |t|
t.string "title", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

add_foreign_key "questions", "surveys"
end

0 comments on commit 35059eb

Please sign in to comment.