-
Notifications
You must be signed in to change notification settings - Fork 1
Run test PG::ForeignKeyViolation: ERROR: insert or update on table "employees" violates foreign key constraint
Victoriano edited this page Jun 25, 2022
·
2 revisions
PG::ForeignKeyViolation: ERROR: insert or update on table "employees" violates foreign key constraint
Error:
EmployeesControllerTest#test_can_not_get_employees_index_without_authenticate:
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "employees" violates foreign key constraint "fk_rails_b82b548cdd"
DETAIL: Key (store_id)=(1) is not present in table "stores".
or
Error:
EmployeesControllerTest#test_should_delete_an_employee:
ActiveRecord::InvalidForeignKey: PG::ForeignKeyViolation: ERROR: insert or update on table "employees" violates foreign key constraint is not present in table "stores".
The error arises because the postgresql
database does not have administrator [root] permissions.
-
From postgresql as root -> terminal.
1.1 You create a new user. 1.2 You grant administrator permission.
-
Work directly, as postgresql root.