Created
December 11, 2021 01:32
-
-
Save eastside/43c21470ec473089d9dc0ed6aa665a91 to your computer and use it in GitHub Desktop.
MySQL_Zero_Downtime_SchemaChange.sh
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
#!/bin/bash | |
# Example of how to use Percona's online schema changer tool. | |
# Tips! | |
# Don't put any semicolons in your schema commmands! | |
# Separate schema commands by commas; i.e., ADD COLUMN y_id bigint NULL, ADD CONSTRAINT y_fk FOREIGN KEY (y_id) REFERENCES y(y_id)" | |
# When testing, remove the --execute flag! | |
# This'll print out lots of rich output too! | |
pt-online-schema-change \ | |
--execute \ | |
--progress time,1 \ | |
--print \ | |
--recursion-method=none \ | |
-h $HOST \ | |
-u $USER \ | |
--ask-pass \ | |
--alter-foreign-keys-method drop_swap \ | |
--alter "$COMMAND" \ | |
D=heart,t=lambda_invocation_set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment