Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message header lost on commit error #119

Open
PizzaPartyInc opened this issue May 10, 2021 · 5 comments
Open

Message header lost on commit error #119

PizzaPartyInc opened this issue May 10, 2021 · 5 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@PizzaPartyInc
Copy link
Contributor

Summary

When you try to commit a migration which has a --! Message: header in current.sql, and that migration fails for some reason, e.g. syntax error, current.sql is restored, but the --! Message: is lost.

Steps to reproduce

Have contents of current.sql as such:

--! Message: test-migration

DROP TABLE IF EXISTS app_public.table_name CASCADE;
CREATE TABLE app_public.table_name(
  id TEXT PRIMARY KEY,
  title TEXT, --this comma causes an error
);

run the commit command and get an error like this:
image

Expected results

Have contents of current.sql the same as before failure:

--! Message: test-migration

DROP TABLE IF EXISTS app_public.table_name CASCADE;
CREATE TABLE app_public.table_name(
  id TEXT PRIMARY KEY,
  title TEXT, --this comma causes an error
);

Actual results

Actual contents of current.sql are missing the header:

DROP TABLE IF EXISTS app_public.table_name CASCADE;
CREATE TABLE app_public.table_name(
  id TEXT PRIMARY KEY,
  title TEXT, --this comma causes an error
);

Additional context

graphile-migrate version 1.0.2.

Possible Solution

Since there is a log before that like

graphile-migrate[shadow]: Running migration '000002-test-migration.sql'

It should be possible to get the message value at least from filename.

@PizzaPartyInc PizzaPartyInc added the 🐛 bug Something isn't working label May 10, 2021
@benjie benjie added bug Something isn't working good first issue Good for newcomers and removed 🐛 bug Something isn't working labels May 10, 2021
@benjie
Copy link
Member

benjie commented May 24, 2021

It's unlikely I'll get to this in a timely manner because it's simply not very high priority. I'd love to see a PR for it thought 👍

@PizzaPartyInc
Copy link
Contributor Author

Thanks for the heads up! It might also take a while for me to free some time, but it's not a big inconvenience, so totally fine for it to wait :)

@hionnode
Copy link

Can I take this up ?

@PizzaPartyInc
Copy link
Contributor Author

No objections from my side :)

@benjie
Copy link
Member

benjie commented Jun 28, 2021

Sure 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants