-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add downgrade command (close #1156) #3760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Deploy preview for hasura-docs ready! Built with commit 8beca02 |
|
Review app for commit 9a8339c deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit a52611c deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit 34ccb24 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
server/src-lib/Hasura/Server/Init.hs
Outdated
| where | ||
| -- This implements the mapping between application versions | ||
| -- and catalog schema versions. | ||
| readVersion "v1.0.0-alpha0" = Just "1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think having the mapping here is strictly worse than keeping it in documentation, because it's easier to forget to update it, and the user won't have any way to downgrade in that case. At least using catalog versions, we can tell them the exact command to use. I'm happy to hear alternatives if anyone has ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you think it’s easier to forget to update this mapping than one in the documentation? I don’t see why one would be more obvious than the other.
In any case, I think being able to treat catalog versions as an implementation detail our users don’t have to worry about is a big enough win that I lean toward this approach, anyway. However, it does make me want two other features:
-
I’d like to be able to print the list of versions
graphql-engineknows about somehow. Otherwise, if I enter something like1.1.0-beta.1(leaving off thev) I just get a cryptic “cannot parse value” error, which is very unhelpful.I think the error message for supplying an invalid version should be improved to either list the known versions or tell people how to list them, and there should be something in the
--helpoutput that says how to list them. (We probably don’t want to list them all in the--helptext all the time, since it would be a lot of output.But maybe we could show an example instead, and then we could probably get away with only printing out all the known versions if someone supplies an invalid version.Nevermind, I realized you’ve already done that. So I think it’s fine to just list known versions on invalid input.) -
I’d like to be able to specify a catalog version by specifying a
--catalog-versionflag or something like that. This is useful both for developers working on the server and users trying out PR builds. In the former case, we know the catalog versions, and in the latter, we’re already interacting with users directly, so we can just tell them what to run. Since this would be so easy to add, it seems worthwhile!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lexi-lambda How's this?
|
Review app for commit d85fc84 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit a6e648c deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
This looks good @paf31, couple of things:
|
|
|
|
Review app for commit 40647c0 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit 81b40a4 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
| You can downgrade the catalogue from a particular version to a previous version by executing the ``graphql-engine`` executable on the command line, | ||
| with the ``downgrade`` command, specifying the desired catalog version using one of the ``--to-`` flags. | ||
|
|
||
| .. note:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a rather long note. How about just having the third point as a note (as it's the unexpected case) and have the rest part of the normal tutorial?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, thanks.
|
Review app for commit a5ab503 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit 049ed13 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app for commit 8beca02 deployed to Heroku: https://hge-ci-pull-3760.herokuapp.com |
|
Review app https://hge-ci-pull-3760.herokuapp.com is deleted |
* Add downgrade command * Add docs per @lexi-lambda's suggestions * make tests pass * Update hdb_version once, from Haskell * more work based on feedback * Improve the usage message * Small docs changes * Test downgrades exist for each tag * Update downgrading.rst * Use git-log to find tags which are ancestors of the current commit Co-authored-by: Vamshi Surabhi <0x777@users.noreply.github.com>
Description
Adds the
graphql-engine downgradecommand to revert the schema to a previous version.As the help text indicates, the usage is as follows:
--dryRunwill simply show the SQL which would be run, without actually running it.Affected components
Related Issues
#1156
Solution and Design
I copied the downgrade scripts from the docs.hasura.io website into the migrations folder, and then removed the ones which don't seem to work against the latest schema any more. I can downgrade as far as schema version 12 but no further.
The code picks out the correct range of scripts to be run, and runs them in order.
Steps to test and verify
Tested by migrating back to various older versions, and then trying to upgrade back by restarting the latest server. As noted above, this works for all versions back to version 12.
Limitations, known bugs & workarounds
Server checklist
Catalog upgrade
Does this PR change Hasura Catalog version?
Metadata
Does this PR add a new Metadata feature?
GraphQL
Breaking changes