Skip to content
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

[REF] Create Alter Column function in upgrade base class #25174

Merged

Conversation

seamuslee001
Copy link
Contributor

Overview

This creates an alterColumn function similar to that of addColumn and refactors the upgrade code from #25143 to use the new method

Before

No standard method for modifying columns in the database during upgrades

After

One standard method

ping @colemanw

if ($localizable) {
if ($locales) {
foreach ($locales as $locale) {
$queries[] = "ALTER TABLE `$table` CHANGE `{$column}_{$locale}` `description_{$locale}` $properties";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$queries[] = "ALTER TABLE `$table` CHANGE `{$column}_{$locale}` `description_{$locale}` $properties";
$queries[] = "ALTER TABLE `$table` CHANGE `{$column}_{$locale}` `{$column}_{$locale}` $properties";

Comment on lines 591 to 592
if ($localizable) {
if ($locales) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two if statements could be combined to

Suggested change
if ($localizable) {
if ($locales) {
if ($localizable && $locales) {

@seamuslee001 seamuslee001 force-pushed the ref_create_alter_column_function branch from c948fab to f2cbacf Compare December 14, 2022 23:05
@seamuslee001
Copy link
Contributor Author

thanks @colemanw I think I have patched up both things now

@demeritcowboy demeritcowboy merged commit e9e87cd into civicrm:master Dec 16, 2022
@seamuslee001
Copy link
Contributor Author

thanks @demeritcowboy @colemanw

@seamuslee001 seamuslee001 deleted the ref_create_alter_column_function branch December 16, 2022 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants