Open pvagare opened 9 years ago
Hi @pvagare,
Did you change the migration file to force a foreign key reference between survey_questions and surveys?
I'm trying to mimic your issues with the migration, but I'm not seeing that constraint in the Postgres generated SQL. Could you show me the 20150515142125_create_survey.rb and your schema.rb files?
Thank you!
Hi! A few years later but I am having the same error. Just following the instruction in the read me (no changes in the migration) and I have this same result: `$ bundle exec rake db:migrate --trace Invoke db:migrate (first_time) Invoke environment (first_time) Execute environment Invoke db:load_config (first_time) Execute db:load_config Execute db:migrate == 20170522133701 CreateSurvey: migrating ===================================== -- create_table(:survey_surveys) -> 0.1217s -- create_table(:survey_questions) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "surveys" does not exist : CREATE TABLE "survey_questions" ("id" serial primary key, "survey_id" integer , "text" character varying , "created_at" timestamp , "updated_at" timestamp , CONSTRAINT fk_survey_questions_survey_id FOREIGN KEY ("survey_id") REFERENCES "surveys" ("id")) `
@alex-quiterio sorry for unassigning you. No idea of how i did it...
Hi ,
Please suggest the solution for Db migration error.
PG::UndefinedTable: ERROR: relation "surveys" does not exist : CREATE TABLE "survey_questions" ("id" serial primary key, "survey_id" integer, "text" character varying(255), "created_at" timestamp, "updated_at" timestamp, CONSTRAINT fk_survey_questions_survey_id FOREIGN KEY ("survey_id") REFERENCES "surveys" ("id")) /home/test/db/migrate/20150515142125_create_survey.rb:15:in
up' ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "surveys" does not exist : CREATE TABLE "survey_questions" ("id" serial primary key, "survey_id" integer, "text" character varying(255), "created_at" timestamp, "updated_at" timestamp, CONSTRAINT fk_survey_questions_survey_id FOREIGN KEY ("survey_id") REFERENCES "surveys" ("id")) /home/test/db/migrate/20150515142125_create_survey.rb:15:in
up' PG::UndefinedTable: ERROR: relation "surveys" does not exist /home/test/db/migrate/20150515142125_create_survey.rb:15:in `up' Tasks: TOP => db:migrate (See full trace by running task with --trace)Thank you !