hasura / hasura/graphql-engine

hasura migrate create --from-server loses manual SQL migrations which breaks enum tables

Open
#4,222 5 comments 2 reactions 0 assignees View on GitHub
c/cli
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

If you use that approach to squash migrations, you lose any manual `INSERT INTO` SQL migrations that you've run.

The main problem with this is that if you have any enum tables, they new migrations will break since enum tables must have at least one row.

At a minimum, this should be noted in the docs (happy to put in some copy if you want) but ideally the `--from-server` option should have an option to include manual SQL insertion migrations or a big flashing warning when you try to run it on a DB with enum tables.

This is on GQL Engine 1.1 but has been an issue since enum tables were released.

Contributor guide

Open the contributing guide

Research direction

Start with the `hasura migrate create --from-server` entry point and review how server-generated migrations relate to manual `INSERT INTO` migrations. Confirm the enum-table failure case described in the issue, then determine whether the documented result should be a warning or whether the command needs an option to include manual SQL migrations.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres
Domain
cli, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.