Skip to content

Message header lost on commit error #119

Open
@PizzaPartyInc

Description

@PizzaPartyInc

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions