This PR fixes the problem that add_index no longer uses pt-online-schema-change to alter the table on Rails 6.1+.
This regression was unintentionally introduced back in #58 when an update was made to make Departure works with Rails 6.1. This did not get caught by our test suite because the test suite did not really test that the command was properly shelled out to pt-online-schema-change or not, and only asserting the result of the operation.
This commit updates the code in add_index to execute query with ALTER TABLE instead of CREATE INDEX. We need to call execute with a SQL starting with ALTER TABLE for Departure to kick in and shell out to pt-online-schema-change.
This commit also update specs related to adding/removing index to making sure that we actually call pt-online-schema-change to perform the DDL operation by making sure that Open3.popen3 has been called to prevent future accidental regression.
This PR fixes the problem that
add_index
no longer usespt-online-schema-change
to alter the table on Rails 6.1+.This regression was unintentionally introduced back in #58 when an update was made to make Departure works with Rails 6.1. This did not get caught by our test suite because the test suite did not really test that the command was properly shelled out to
pt-online-schema-change
or not, and only asserting the result of the operation.This commit updates the code in
add_index
to execute query withALTER TABLE
instead ofCREATE INDEX
. We need to callexecute
with a SQL starting withALTER TABLE
for Departure to kick in and shell out topt-online-schema-change
.This commit also update specs related to adding/removing index to making sure that we actually call
pt-online-schema-change
to perform the DDL operation by making sure thatOpen3.popen3
has been called to prevent future accidental regression.This fixes #61.