Last active
March 11, 2021 02:45
-
-
Save ayushgp/fa9c0c7f6f2d45a26b25bba4df32b07b to your computer and use it in GitHub Desktop.
Take Hasura migrations from one server and apply them to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Take Hasura migrations from staging and apply them to prod | |
# Usage: ./migrate.sh "<staging-endpoint>" "<staging-secret>" "<prod-endpoint>" "<prod-secret>" "<migration-name>" | |
STAGING_ENDPOINT="$1" | |
STAGING_SECRET="$2" | |
PROD_ENDPOINT="$3" | |
PROD_SECRET="$4" | |
MIGRATION_NAME="$5" | |
# Create migrations and metadata exports using staging env after changes | |
hasura migrate create $MIGRATION_NAME --from-server --endpoint $STAGING_ENDPOINT --admin-secret $STAGING_SECRET | |
hasura metadata export --endpoint $STAGING_ENDPOINT --admin-secret $STAGING_SECRET | |
# Apply migrations to prod | |
hasura migrate apply --endpoint $PROD_ENDPOINT --admin-secret $PROD_SECRET | |
hasura metadata apply --endpoint $PROD_ENDPOINT --admin-secret $PROD_SECRET |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment