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

Migrate database charset to utf8mb4 and storage engine to InnoDB #4508

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

Deltik
Copy link
Member

@Deltik Deltik commented May 22, 2021

Fixes: #4501

Motivation and Context

Add emoji support and stop using the obsolete MyISAM storage engine

Description

Convert and run e107 using the MySQL/MariaDB utf8mb4 character set and InnoDB storage engine

Components affected:

  • db_verify now checks and corrects the table storage engine
  • db_verify now checks and corrects the table default character set
    • Note: Field character sets can still be overridden
    • Note: When correcting, the entire table is converted to the target
      charset.
  • The alt_auth plugin now connects via PDO using the e107 default
    charset, utf8mb4
  • e_db_pdo now sets the charset to utf8mb4. This is currently not
    customizable because it was previously not customizable.
  • install.php now generates an e107_config.php file with
    $mySQLcharset = 'utf8mb4';, though this option is not actually used.
  • install.php now removes plugin tables before installing plugins.
  • e_db_mysql now only accepts the utf8mb4 charset. Previously, it
    only accepted the utf8 charset.
  • e_db_mysql now configures mysqli_real_escape_string to match the
    new default charset, utf8mb4.
  • Plugin installations now use the preferred MySQL table storage engines
    and charsets.

The preferred MySQL table storage engines are now mapped like so:

  • If ENGINE=MyISAM is specified, the actual storage engine set will be
    the first available of: InnoDB, Aria, Maria, MyISAM
  • If ENGINE=Aria is specified, the actual storage engine set will be
    the first available of: Aria, Maria, MyISAM
  • If ENGINE=InnoDB is specified, the actual storage engine set will be
    the first available of: InnoDB, XtraDB
  • If ENGINE=XtraDB is specified, the actual storage engine set will be
    the first available of: XtraDB, InnoDB

The preferred MySQL character set is now aliased like so:

  • utf8 => utf8mb4
  • utf8mb3 => utf8mb3
  • utf8mb4 => utf8mb4

How Has This Been Tested?

Unit tests included in pull request

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist

InnoDB storage engine

Components affected:
* `db_verify` now checks and corrects the table storage engine
* `db_verify` now checks and corrects the table default character set
  * Note: Field character sets can still be overridden
  * Note: When correcting, the entire table is converted to the target
    charset.
* The alt_auth plugin now connects via PDO using the e107 default
  charset, utf8mb4
* `e_db_pdo` now sets the charset to utf8mb4. This is currently not
  customizable because it was previously not customizable.
* `install.php` now generates an `e107_config.php` file with
  `$mySQLcharset = 'utf8mb4';`, though this option is not actually used.
* `install.php` now removes plugin tables before installing plugins.
* `e_db_mysql` now only accepts the `utf8mb4` charset. Previously, it
  only accepted the `utf8` charset.
* `e_db_mysql` now configures `mysqli_real_escape_string` to match the
  new default charset, `utf8mb4`.
* Plugin installations now use the preferred MySQL table storage engines
  and charsets.

The preferred MySQL table storage engines are now mapped like so:
* If `ENGINE=MyISAM` is specified, the actual storage engine set will be
  the first available of: InnoDB, Aria, Maria, MyISAM
* If `ENGINE=Aria` is specified, the actual storage engine set will be
  the first available of: Aria, Maria, MyISAM
* If `ENGINE=InnoDB` is specified, the actual storage engine set will be
  the first available of: InnoDB, XtraDB
* If `ENGINE=XtraDB` is specified, the actual storage engine set will be
  the first available of: XtraDB, InnoDB

The preferred MySQL character set is now aliased like so:
* `utf8`    => `utf8mb4`
* `utf8mb3` => `utf8mb3`
* `utf8mb4` => `utf8mb4`

Fixes: e107inc#4501
@Deltik Deltik requested a review from a team May 22, 2021 05:49
@Deltik Deltik force-pushed the fix/4501 branch 5 times, most recently from 01e1680 to d793b7f Compare May 22, 2021 07:01
@Deltik Deltik force-pushed the fix/4501 branch 4 times, most recently from 29d9ffd to 78d9e4b Compare July 17, 2021 14:07
@Deltik Deltik force-pushed the fix/4501 branch 5 times, most recently from 4f99536 to 1b08eb0 Compare September 11, 2021 16:54
Copy link
Member

@CaMer0n CaMer0n left a comment

Choose a reason for hiding this comment

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

Scheduled for e107 v2.4, which will include the minimum requirement of InnoDB due to the following issues:

#2729
#4235
#2559 (comment)

Copy link

codeclimate bot commented Nov 25, 2023

Code Climate has analyzed commit d790faa and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 43.1% (80% is the threshold).

This pull request will bring the total coverage in the repository to 39.1% (-0.1% change).

View more on Code Climate.

@Moc Moc added this to the e107 2.4.0 milestone Nov 26, 2023
@CaMer0n CaMer0n marked this pull request as ready for review November 28, 2023 19:57
@CaMer0n CaMer0n merged commit 951b09d into e107inc:master Nov 28, 2023
28 of 29 checks passed
@Deltik Deltik deleted the fix/4501 branch November 29, 2023 00:42
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.

Migrate database charset to utf8mb4 (emoji support) and storage engine to InnoDB
3 participants