hasura / hasura/graphql-engine
Generate down migration for DROP TABLE
- 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
Assessment
This issue has not been assessed yet.