Hello I started my rails application using sqlite, however when I tried deploying it on heroku I found out that I needed to use postgreSQL. So I went through the trouble to change my gemfile and database.yml file and create the new postgresql database. However when I try to migrate my database I get the error:
ActiveRecord::StatementInvalid: PG::UndefinedObject: ERROR: type "reference" does not exist
LINE 1: ALTER TABLE "questions" ADD "quiz_id" reference
that is probably because I used a reference to make a relation in my db
I am basically looking for the fix for this situation.
Here are my migrations(if it matters):
class CreateQuestions < ActiveRecord::Migration
def change
create_table :questions do |t|
t.string :question
t.string :answer1
t.string :answer2
t.string :answer3
t.string :answer4
t.integer :correct_id
t.timestamps null: false
end
end
end
class CreateQuizzes < ActiveRecord::Migration
def change
create_table :quizzes do |t|
t.string :name
t.string :subject
t.timestamps null: false
end
end
end
class AddQuizIdToQuestions < ActiveRecord::Migration
def change
add_column :questions, :quiz_id, :reference
end
end
Edit new question: When on my heroku server there are some dead pages, but not when I am running on my local server. Here is my heroku address: https://krisquiz.herokuapp.com/
The dead pages are when you submit a question and when you try and start a quiz. I looked at the urls and they look properly. The only thing in common that I can think of for the two pages is that I built the urls manually for the links (ex: request.base_url + '/quiz/' + quiz.id.to_s + '/start'). As I am not sure what I need to give you as information just tell me and I will try to quickly get back to you.