Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Failed migration from 7623766 to 0026ba2
StandardError: An error has occurred, this and all later migrations canceled:
PG::ForeignKeyViolation: ERROR: insert or update on table "statuses" violates foreign key constraint "fk_rails_94a6f70399"
DETAIL: Key (in_reply_to_id)=(14576) is not present in table "statuses".
: ALTER TABLE "statuses" ADD CONSTRAINT "fk_rails_94a6f70399"
FOREIGN KEY ("in_reply_to_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Migrating to AddForeignKeysForAccounts (20170604144747)
== 20170604144747 AddForeignKeysForAccounts: migrating ========================
-- add_foreign_key(:statuses, :accounts, {:on_delete=>:cascade})
-> 0.0892s
-- add_foreign_key(:statuses, :accounts, {:column=>:in_reply_to_account_id, :on_delete=>:nullify})
-> 0.0199s
-- add_foreign_key(:statuses, :statuses, {:column=>:in_reply_to_id, :on_delete=>:nullify})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment