[parser] support create-table flag by najisawas · Pull Request #1383 · github/gh-ost
Description
This PR adds a new flag called "--create-table", an alternative to the "--alter" flag. With "--create-table" you can redefine the table that you want gh-ost to migrate to, effectively supporting what would have required multiple ALTERs.
For example, If you need to restructure the secondary indexes on a MySQL table, you would need to do the following:
Assuming a and b are already columns in the table...
- ADD COLUMN
xINT, ADD COLUMNyVARCHAR(24),
ADD INDEXa_x_idx(a,x),
ADD INDEXy_idx(y),
DROP INDEXa_b_idx
Now you can simply provide a "--create-table" flag like so
--create-table="( ..., x INT, y VARCHAR(24), ... KEY a_x_idx (a,x), KEY y_idx (y) ...)"
The PR is a bit large as it includes some refactors to maintain code cleanliness. I can separate out some of the refactors into separate PRs for ease of review