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

Fix addColumn on mysql when including a "value" attribute #3070

Merged
merged 5 commits into from
Aug 8, 2022

Conversation

nvoxland
Copy link
Contributor

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Mysql's "alter column" syntax we use to assign the final "not null" constraint to an added column will lose the defaultValue that was set earlier.

Make sure the default value gets re-applied if needed.

Issue introduced in #928
Fixes #2657

Things to be aware of

  • Only impacts mysql/mariadb when one of the defaultValue is set

Things to worry about

  • Do all the variations of defaultValue* work?

@github-actions
Copy link

github-actions bot commented Jul 16, 2022

Unit Test Results

  4 620 files  ±0    4 620 suites  ±0   39m 41s ⏱️ + 3m 21s
  4 611 tests ±0    4 396 ✔️ +4     215 💤  - 4  0 ±0 
54 504 runs  ±0  49 484 ✔️ +4  5 020 💤  - 4  0 ±0 

Results for commit d05fdfd. ± Comparison against base commit 4215cf6.

♻️ This comment has been updated with latest results.

@kataggart kataggart added this to To Do in Conditioning++ via automation Jul 21, 2022
@kataggart
Copy link
Contributor

@nvoxland apologies if I moved this one around incorrectly; I saw for some reason the linked issue was in Code review, but pretty sure this PR is still in development. I put them both in development. Thanks

@nvoxland nvoxland requested a review from suryaaki2 July 27, 2022 15:59
@kataggart kataggart added this to the NEXT milestone Jul 28, 2022
@kataggart kataggart removed this from the NEXT milestone Aug 1, 2022
@FBurguer FBurguer self-assigned this Aug 2, 2022
@kataggart kataggart added this to the NEXT milestone Aug 4, 2022
@FBurguer
Copy link

FBurguer commented Aug 4, 2022

For this PR I did the next tests:
defaultValue tests:

  1. Add column with value, defaultValue and not NULL: PASS
  2. Add column without value, defaultValue and not NULL: PASS
  3. Add column with value, defaultValue and nullable: PASS
  4. Add column without value, defaultValue and nullable: PASS
  5. Add column with value, without defaultValue and not NULL: PASS
  6. Add column without value or defaultValue, with not NULL: PASS
  7. Add column with value, without defaultValue and not NULL: PASS
  8. Add column without value or defaultValue, and nullable: PASS

defaultValueBoolean tests

  1. Add column with valueBoolean, defaultValueBoolean and not NULL: PASS
  2. Add column without valueBoolean, defaultValueBoolean and not NULL: PASS
  3. Add column with valueBoolean, defaultValueBoolean and nullable: PASS
  4. Add column without valueBoolean, defaultValueBoolean and nullable: PASS

defaultValueComputed tests

  1. Add column with valueComputed, defaultComputed and not NULL: PASS
  2. Add column without valueComputed, defaultValueComputed and not NULL: PASS
  3. Add column with valueComputed, defaultValueComputed and nullable: PASS
  4. Add column without valueComputed, defaultValueComputed and nullable: PASS
    (Something I noticed: functionas must be used inside () when using them as a parameter for defaultValueComputed and valuecomputed)

defaultValueDate tests

  1. Add column with valueDate, defaultDate and not NULL: PASS
  2. Add column without valueDate, defaultValueDate and not NULL: PASS
  3. Add column with valueDate, defaultValueDate and nullable: PASS
  4. Add column without valueDate, defaultValueDate and nullable: PASS

defaultValueNumeric tests

  1. Add column with valueDate, defaultNumeric and not NULL: PASS
  2. Add column without valueDate, defaultValueNumeric and not NULL: PASS
  3. Add column with valueDate, defaultValueNumeric and nullable: PASS
  4. Add column without valueDate, defaultValueNumeric and nullable: PASS

Test environment:
Windows 10
Java 8
MySQL container v8.0.27

@nvoxland nvoxland merged commit 82dac07 into master Aug 8, 2022
Conditioning++ automation moved this from To Do to Done Aug 8, 2022
@nvoxland nvoxland deleted the fix-mysql-addcolumn branch August 8, 2022 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

defaultValue is not set on non-nullable columns when value is also specified
4 participants