这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@scriptonist
Copy link
Contributor

@scriptonist scriptonist commented Jan 16, 2020

Description

This PR will add a --goto flag to the hasura migrate apply command, which can set version to the specified value while applying all the migrations in the chain leading to it.

Let's say we have the following state.

$ hasura migrate status
VERSION        SOURCE STATUS  DATABASE STATUS
...
1564701126000  Present        Present
1564701547000  Present        Present
1564702123000  Present        Present
1564702123002  Present        Present
1564702123003  Present        Present
1564738682051  Present        Present
1564738682052  Present        Not Present
1564738682053  Present        Not Present

So, hasura migrate apply --goto 1564702123002, will result in the following status.

$ hasura migrate status
VERSION        SOURCE STATUS  DATABASE STATUS
...
1564701126000  Present        Present
1564701547000  Present        Present
1564702123000  Present        Present
1564702123002  Present        Present
1564702123003  Present        Not Present
1564738682051  Present        Not Present
1564738682052  Present        Not Present
1564738682053  Present        Not Present

Affected components

  • Server
  • Console
  • CLI
  • Docs
  • Community Content
  • Build System
  • Tests
  • Other (list it)

Related Issues

#2689

Breaking changes

  • No Breaking changes
  • There are breaking changes:

@netlify
Copy link

netlify bot commented Jan 16, 2020

Deploy preview for hasura-docs ready!

Built with commit 3787058

https://deploy-preview-3715--hasura-docs.netlify.com

@hasura-bot
Copy link
Contributor

Review app for commit 3787058 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-37870580

@netlify
Copy link

netlify bot commented Jan 27, 2020

Deploy preview for hasura-docs ready!

Built with commit 284f5a1

https://deploy-preview-3715--hasura-docs.netlify.com

@hasura-bot
Copy link
Contributor

Review app for commit 64ecf6d deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-64ecf6d4

@scriptonist scriptonist marked this pull request as ready for review January 27, 2020 06:16
@hasura-bot
Copy link
Contributor

Review app for commit 2327082 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-2327082e

@hasura-bot
Copy link
Contributor

Review app for commit 9442c9a deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-9442c9ae

@hasura-bot
Copy link
Contributor

Review app for commit 1c0607f deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-1c0607fe

@hasura-bot
Copy link
Contributor

Review app for commit e6e6105 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-e6e61052

@hasura-bot
Copy link
Contributor

Review app for commit b8384e9 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-b8384e9f

@scriptonist scriptonist added the c/cli Related to CLI label Jan 29, 2020
@hasura-bot
Copy link
Contributor

Review app for commit a575361 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-a5753615

@hasura-bot
Copy link
Contributor

Review app for commit 284f5a1 deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-284f5a16

arvi3411301
arvi3411301 previously approved these changes Jan 31, 2020
@hasura-bot
Copy link
Contributor

Review app for commit 3497b1d deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-3497b1d6

@hasura-bot
Copy link
Contributor

Review app for commit 8e5705e deployed to Heroku: https://hge-ci-pull-3715.herokuapp.com
Docker image for server: hasura/graphql-engine:pull3715-8e5705ef

@shahidhk shahidhk merged commit c258fa7 into hasura:master Feb 3, 2020
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-3715.herokuapp.com is deleted

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
…ura#3715)

* cli: add --goto <version> flag to migrate command

* cli: fix error encoutered in goto, when on version -1

* do down migrations one step down

* reorganize code

* in case of up "gotos" make sure that all previous migration in migration chain are applied

* modify readUp and readDown functions to account for --goto use case

* refactor to clean up and adopt a better implementation addressing the comments

* remove empty error handling step

* return ErrNoChange when no migrations were applied

* respect m.stop() can panic so place conditional cases after that and add a couple other small fixes

* fix bug caused by early checking of versions

* fix to add migration_mode and nil version check

* add some more examples for migrate apply command

Co-authored-by: Aravind Shankar <face11301@gmail.com>
Co-authored-by: Shahidh K Muhammed <muhammedshahid.k@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/cli Related to CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants