New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ModuleInstaller): Add method to rename tables in the DB #623
base: develop
Are you sure you want to change the base?
feat(ModuleInstaller): Add method to rename tables in the DB #623
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks !
My remarks are mostly questions, and also we may add more uses cases in the phpunit
* @throws \CoreException | ||
* @throws \MySQLException | ||
*/ | ||
public function testRenameTableInDB() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also test :
- orig and dest on the same existing table name
- orig and dest on the same non existing table name
- orig on a non existing table name
- dest on an existing table name
This may be easier to code using a dataprovider returning orig and dest names, and expected result ?
Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technical review:
- Unit test:
- Move table revert in tearDown() method for better robustness in case there is an issue within the test method
- New method:
- Add
SetupLog
message in exit conditions (except the!MetaModel::DBExists(false)
). SeeRenameEnumValueInDB()
for a real example,MoveColumnInDB()
is a bad one.
- Add
# Conflicts: # tests/php-unit-tests/unitary-tests/setup/ModuleInstallerAPITest.php
Base information
Objective
To have a helper method that can rename a table in DB during setup. The helper method can silently ignore the renaming if the origin table doesn't exist or the destination table already exists. This to avoid errors when running the setup again after the migration has ben done before.
Proposed solution
Creation of
ModuleInstallerAPI::MoveColumnInDB
.Checklist before requesting a review