hasura / hasura/graphql-engine

Generate down migration for DROP TABLE

Open
#6,798 1 comment 3 reactions 0 assignees View on GitHub
a/collab-ci-cd p/medium
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Wondering if there is a way to generate the down.sql migration for a table drop. This would essentially be a CREATE statement. Currently only an up.sql file is generated, which contains the DROP statement.

We use a custom script to manually apply migrations missing from our current branch compared to a target git branch, so as we jump between feature branches, Hasura state remains consistent with the given feature set.

Essentially, we take all down migrations that exist in the target branch and not in the current, apply them, and so the state is clean and our generated types work with the base branch. When we switch to the child feature branch, all up migrations are automatically applied.

This mechanism doesn't work if DROP table was performed in the feature branch, as it has no corresponding revert migration. Currently creating these manually.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.