hasura / hasura/graphql-engine

non-auto-generated down migrations can include syntax errors

Open
#7,211 1 comment 0 reactions 0 assignees View on GitHub
support/needs-more-info
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

hi there, we've noticed a small bug in the generated down.sql file in migrations where hasura cannot auto-generate it. if the original up statement goes over multiple lines, only the first line is commented out, please see the following example:

```sql
- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."sessions" add column "role" text
not null;
```

as far as we can tell, this should be:

```sql
- Could not auto-generate a down migration.
-- Please write an appropriate down migration for the SQL below:
-- alter table "public"."sessions" add column "role" text
-- not null;
```

not massively urgent, but thought it was worth reporting

Contributor guide

Open the contributing guide

Research direction

Start in the migrations path that generates the non-auto-generated down.sql file, using the multiline SQL example in the issue to reproduce the problem. Check how each line of the original up statement is commented, and consider the work done when every line in the generated down migration is validly commented.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.