cli icon indicating copy to clipboard operation
cli copied to clipboard

feat: add ERROR detail to output of migration

Open snewcomer opened this issue 3 years ago • 2 comments
trafficstars

Pull Request check-list

  • [x] Does npm run test pass with this change (including linting)?
  • [x] Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • [ ] Have you added new tests to prevent regressions?
  • [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?

Description of change

close https://github.com/sequelize/cli/issues/1138

This PR adds additional error output. Currently the error output may be insufficient to hone in on the problem.

https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html

Desired behaviour -

ERROR: SequelizeForeignKeyConstraintError: insert or update on table "my_table" violates foreign key constraint "...."
ERROR DETAIL: Key (my_column)=(1) is not present in table "my_table"

Alternatives

Behind a debug flag. My initial hunch is to consider this a helpful feature that users get out of the box. Happy to put behind a debug flag though!

snewcomer avatar Aug 20 '22 16:08 snewcomer

Hi! Thanks for the PR! I haven't given the alternative more thought yet, but can you add one or more tests for this? More tests is especially preferred if on some cases more information is given that might be considered confidential

WikiRik avatar Aug 21 '22 19:08 WikiRik

@WikiRik Gave a quick look around and not seeing a good extension point for this test. Do you happen to know of a place?

snewcomer avatar Sep 05 '22 03:09 snewcomer

The changes just returning void and hard to test, maybe to test the detail property existence? @WikiRik

fzn0x avatar Sep 27 '22 01:09 fzn0x

@snewcomer sorry for not responding before, I took a look as well and we do not really have any tests to check our error behaviour. We'll add that in a later stage. For now, this is fine

Thanks for the PR!

WikiRik avatar Sep 27 '22 11:09 WikiRik

:tada: This PR is included in version 6.5.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Sep 27 '22 11:09 github-actions[bot]