graphile / migrate

Opinionated SQL-powered productive roll-forward migration tool for PostgreSQL.
MIT License
751 stars 58 forks source link

Does not point to the file containing the error #95

Closed Nembus closed 4 years ago

Nembus commented 4 years ago

Summary

Instead, the script just mentions current.sql even if we're using current directory instead of current.sql

Steps to reproduce

Expected results

Actual results

Additional context

[2020-10-08T19:22:48.788Z]: Running current.sql

🛑 Error occurred whilst processing migration error: cannot drop function app_public.current_user_scope() because other objects depend on it at Parser.parseErrorMessage (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:278:15) at Parser.handlePacket (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:39:38) at Socket. (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/index.js:10:42) at Socket.emit (events.js:321:20) at addChunk (_stream_readable.js:297:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10) at TCP.onStreamRead (internal/stream_base_commons.js:186:23)

(node:45201) UnhandledPromiseRejectionWarning: error: cannot drop function app_public.current_user_scope() because other objects depend on it at Parser.parseErrorMessage (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:278:15) at Parser.handlePacket (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:126:29) at Parser.parse (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/parser.js:39:38) at Socket. (/Users/timmyk/code/graphql/Gel/@app/db/node_modules/pg-protocol/dist/index.js:10:42) at Socket.emit (events.js:321:20) at addChunk (_stream_readable.js:297:12) at readableAddChunk (_stream_readable.js:273:9) at Socket.Readable.push (_stream_readable.js:214:10) at TCP.onStreamRead (internal/stream_base_commons.js:186:23) (node:45201) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)

Possible Solution

benjie commented 4 years ago

I witnessed this over screen sharing 👍

benjie commented 4 years ago

Reproduced with current.sql migration:

drop function if exists one();
create function one() returns int as $$
select 1;
$$ language sql stable;

drop table if exists foo;
create table foo (
  id serial primary key,
  number int not null default one()
);

drop function if exists one();
create function one() returns int as $$
  select 1;
$$ language sql stable;
benjie commented 4 years ago

I've fixed the unhandled promise rejection; that was a minor oversight in the watch code.

Unfortunately PostgreSQL does not give us enough information for us to know where this error originated within the document we've sent, which is unfortunate.

Screenshot_20201009_112733

(We need the position value to be specified.)

I've done the best I can with the information I have:

Screenshot_20201009_112926

benjie commented 4 years ago

(Fix is out in v1.0.2)

Nembus commented 4 years ago

I just ran npm udate graphile-migrate, and it incremented to v1.0.2. Thank you, for the quick fix. It's good to see some errors.

Tim

On October 9, 2020 at 11:48:16 AM, Benjie Gillam (notifications@github.com) wrote:

(Fix is out in v1.0.2)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/graphile/migrate/issues/95#issuecomment-706258344, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABWEDD5LZXDB3JPMZOAQV3SJ4WEBANCNFSM4SJKETNA .