def down do
drop constraint(:users, "must_belong_to_company_or_organization")
Repo.update_all(User, set: [company_id: nil, organization_id: nil])
end
** (Postgrex.Error) ERROR 23514 (check_violation): new row for relation "users" violates check constraint "must_belong_to_company_or_organization"
table: users
constraint: must_belong_to_company_or_organization
I expect the constraint to be dropped before the update is executed.
Migration instructions are accumulated. If you want to execute them before the end of the migration, you need to call flush().
Most helpful comment
Migration instructions are accumulated. If you want to execute them before the end of the migration, you need to call
flush().