Skip to content

Instantly share code, notes, and snippets.

@eastside
Last active February 3, 2023 05:28
Show Gist options
  • Save eastside/2c96878f91d6f4288112a09f4bfef745 to your computer and use it in GitHub Desktop.
Save eastside/2c96878f91d6f4288112a09f4bfef745 to your computer and use it in GitHub Desktop.
MySQL Online Schema Change Example using Percona
#!/bin/bash
pt-online-schema-change \
--execute \
--progress time,1 \
--print \
--recursion-method=none \
-h my_host \
-u root \
--ask-pass \
--alter-foreign-keys-method drop_swap \
--alter "ADD COLUMN aaa bigint NULL, ADD CONSTRAINT bbb FOREIGN KEY (ccc) REFERENCES ddd(eee)" \
D=my_db,t=my_table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment