Git Product home page Git Product logo

drupal_utf8mb4_converter's Introduction

utf8mb4_converter

This is a Drupal utility module to convert MySQL table COLS from UTF8 to UTF8MB4.

The module will list of the current tables in the database and will highlight COLS that need to be converted in GREEN.

  • COLS that are varchar with size less than 191 will simply be converted to mb4 and their column-length will be unchanged.
  • COLS that are varchar with size greater than 191 and are NOT primary keys will be converted and their column-length will be unchanged.
  • COLS that are varchar with size greater than 191 that are primary keys will be highlighted for conversion in green if there are no data row values for that column that are greater than 191 characters in length.
  • COLS that are varchar with size greater than 191 that are primary keys and have row values with lengths greater than 191 characters are highlighted in RED and prevent the "convert all" link from appearing. Resolve those by hand and refresh the page to convert all.

In other words, if no data will be lost by truncation, that is the preferred method. Where data will be lost, the row appears in RED and you should resolve by hand.

#BACKUP YOUR DB FIRST AS YOU ARE WORKING WITHOUT A NET

#Supporting

Included with this module is a few "supporting" files. A .patch that allows core to specify COLLATION and CHARSET vars in the database settings in settings.php.

$database = [
  'default' => [
    'default' => [
      'driver' => 'mysql',
      'database' => 'databasename',
      'username' => 'username',
      'password' => 'password',
      'host' => 'localhost',
      'port' => 3306,
      'prefix' => 'myprefix_',
      'collation' => 'utf8mb4_general_ci',
      'charset' => 'utf8mb4'
    ]
  ]
];

There are also requisite my.cnf changes that need to be made to your mysql process:

[client]
default-character-set = utf8mb4

[mysql]
max_allowed_packet = 128M
default-character-set = utf8mb4
character-set-connection = utf8mb4
character-set-results = utf8mb4

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4

collation-server = utf8mb4_unicode_ci

as well as the actual settings for settings.php that allows the database to use utf8mb4 in all it's sql calls. Without these three pieces in place, Drupal will not be able to store mb4 values in the database once you have converted the tables.

drupal_utf8mb4_converter's People

Contributors

ericstone57 avatar infojunkie avatar khaledblah avatar stovak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.