[parser] support create-table flag
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
#1384
tests still need to be expanded, but wanted to publish an initial revision for visibility
I hesitate to continue expanding the regex-based SQL parsing. If you need to compute the ALTER statement from two CREATE TABLE statements I recommend using https://github.com/planetscale/schemadiff