Errors during migration lack line numbers #374
Replies: 7 comments 1 reply
-
@AndreaCrotti depends what the error is. If it's a syntax error in the migration file, pgsanity can help find that. As for others, I would be interested in seeing more details printed out as well. For example, if I try to drop a view that has dependent views/tables it doesn't print those out, whereas running it in psql will provide me with the list of dependent objects. |
Beta Was this translation helpful? Give feedback.
-
Yesterday we had a similar probelm, where dbmate was just failing on a given line without much information, but the actual error you could see from PSQL was a type mismatching, which made it immediately clear what the problem was, but no way to debug that just with the dbmate error. I guess there should be a way also with the PG go bindings to get more verbose errors right? |
Beta Was this translation helpful? Give feedback.
-
Unfortunately I haven't found a way to get more useful error messages or line numbers. The I will keep this issue open because I agree it could be improved, and someone might have a clever idea to solve this. |
Beta Was this translation helpful? Give feedback.
-
I've put together a proof of concept over here: But before I continue on the effort I would like to plan things out a little first so that I don't waste time doing things that won't be accepted. So my high-level plan would be:
Extra effort idea if you're open to it:
|
Beta Was this translation helpful? Give feedback.
-
@silbinarywolf thanks! I will respond in the PR thread. |
Beta Was this translation helpful? Give feedback.
-
Would appreciate if something of this sort is included as it improves the development experience and is a very elegant way to fix errors in an handwritten sql files. |
Beta Was this translation helpful? Give feedback.
-
Given that this issue (originally #102) has recently celebrated its fourth birthday 🎂, I took a stab at reviewing the PR #204, and left review comments. Rather than burden the OP with bringing their branch up to date with all the changes since the PR was created, as well as implementing any requested changes from my review, I did the work and submitted PR #495. I'd like to propose closing PR #204 in favor of merging PR #495, and thank @silbinarywolf for their initial effort which I borrowed from conceptually. How do people feel about my proposal? |
Beta Was this translation helpful? Give feedback.
-
I just noticed that if I run a
dbmate migrate
and there is an error in one of the statements, the error being printed out is a bit useless, and doesn't even contain the line number or the actual message from Postgres.I checked if there are any options for more verbosity but I don't see that either, so atm we simply don't get errors printed out?
Beta Was this translation helpful? Give feedback.
All reactions