-
Notifications
You must be signed in to change notification settings - Fork 233
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
⚡️ Add faster way to rename column on the same table #676
base: develop
Are you sure you want to change the base?
⚡️ Add faster way to rename column on the same table #676
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.
Careful, this is compatible with MySQL 8.0+, but not MySQL 5.7 which is still supported by iTop. You should stick to the CHANGE
synthax:
Database | Version | CHANGE Compatibility |
RENAME COLUMN Compatibility |
---|---|---|---|
MySQL | < 8.0 | Yes | No |
MySQL | 8.0+ | Yes | Yes |
MariaDB | < 10.5.2 | Yes | No |
MariaDB | 10.5.2+ | Yes | Yes |
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.
CMDBSource::GetfIeldSpec()
can return false, but I rather have an explicit error than hiding it. Good job.
We already have some tests for this method in |
@Molkobain actually, the same method is doing the same without any checks: iTop/setup/moduleinstaller.class.inc.php Line 277 in c6039f4
It will just never occur to return false because of the checks before.
|
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.
Works well on MariaDB 11.3.2 👍
Funny, as that version isn't even supported by Combodo. |
To take all the benefits out of this proposal, the table alteration algorithm must be at least I've just conducted a quick study to check which DDL algorithm is used, and make sure that the syntax ConclusionThe proposed implementation will be quick in any versions supported by iTop, excepted for the rare cases when the MethodologyAs an alternative to measuring the time spent on executing the I've also tested with alter table organization change code new_code varchar(255) default '' null, algorithm=inplace, lock=none;
alter table organization change code new_code varchar(255) default '' null, algorithm=instant; Results
|
Base information
Objective
The process of moving data from one column to another could be simplified a lot when both are on the same table.
Proposed solution
Execute a
RENAME COLUMN
SQL statement instead of the following steps:Checklist before requesting a review