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

dev/core#334 Use the current in use collation and character sets when… #18642

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

seamuslee001
Copy link
Contributor

… creating new custom value tables

Overview

This changes the default attributes for new custom value tables to be dependant on the current in use collation.

Before

Only utf8 charset and utf8_unicode_ci collation were used to create new custom tables

After

Uses the relevant charset for the current collation of the civicrm_contact table.

ping @demeritcowboy @artfulrobot @mattwire

@civibot
Copy link

civibot bot commented Sep 30, 2020

(Standard links)

@civibot civibot bot added the master label Sep 30, 2020
@@ -1610,10 +1610,15 @@ public static function formatCustomField(
*/
public static function defaultCustomTableSchema($params) {
// add the id and extends_id
$collation = CRM_Core_BAO_SchemaHandler::getInUseCollation();
$characterSet = 'utf8';
if (stristr($collaction, 'utf8mb4')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo.
And I'd probably use stripos but that's less important.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, collactioncollation

@artfulrobot
Copy link
Contributor

Great! Thanks for this, it was a real head scratcher for me doing migration work: I'd run the conversion script, think it was all utf8mb4 for sure, then my import script which adds custom fields would throw a 🔧 into the ⚙️ whenever it encountered a 🔧 or a ⚙️ or a 💅

  • General standards
    • Explain (r-explain)
      • PASS : The goal/problem/solution have been adequately explained in the PR.
      • COMMENTS: See related SE question
    • User impact (r-user)
      • PASS: The change would be intuitive or unnoticeable for a majority of users who work with this feature.
    • Documentation (r-doc)
      • PASS: The changes do not require documentation.
      • COMMENTS: We might need to make some noise somewhere about re-running the system.utf8conversion if you've added custom fields since doing it.
    • Run it (r-run)
      • PASS: I have run the code (with the typo fixed) and it worked as expected for me on my utf8mb4 install: the table and text fields were created with utf8mb4 and suitable colaltion. (what is it about spelling that word?!)
  • Developer standards
    • Technical impact (r-tech)
      • PASS: The change preserves compatibility with existing callers/code/downstream.
    • Code quality (r-code)
      • PASS: The functionality, purpose, and style of the code seems clear+sensible.
    • Maintainability (r-maint)
      • PASS: The change sufficiently improves test coverage, or the change is trivial enough that it does not require tests.
    • Test results (r-test)
      • UNREVIEWED - failing at mo because of the typo

@seamuslee001 seamuslee001 force-pushed the dev_core_339_custom_field branch from c244d48 to 799f314 Compare September 30, 2020 20:35
@seamuslee001
Copy link
Contributor Author

going to add Merge on pass based on @artfulrobot testing

@seamuslee001 seamuslee001 merged commit ee523fb into civicrm:master Sep 30, 2020
@seamuslee001 seamuslee001 deleted the dev_core_339_custom_field branch September 30, 2020 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants