0.0
No release in over 3 years
Low commit activity in last 3 years
Poetry is so XIX century, nowadays we express ourselves using emojis. This gem adds a task to migrate mysql utf8 tables to utf8mb4 in rails projects.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
>= 12.3.3
~> 3.0

Runtime

~> 6.1
~> 0.4.0
 Project Readme

Utf8mb4rails

A simple gem that adds a rake task to deal with utf8 to utf8mb4 migrations for mysql.

Installation

Add this line to your application's Gemfile:

gem 'utf8mb4rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install utf8mb4rails

This gem uses departure a Percona's pt-online-schema-change runner for ActiveRecord migrations.

You need to have percona tools installed prior to using this gem. See instructions here.

Usage

This gem will add in your rails project a new task called utf8mb4. This tast is aimed to easily convert tables in utf8 into utf8mb4 without truncating column contents and maintaining its original schema (without changing max sizes).

USE AT YOUR OWN RISK!!!

$ rake -T
...
rake db:utf8mb4                          # migrates a table[/column] (TABLE, COLUMN env vars) to utf8mb encoding
...

You can modify its behavior using env vars.

  • TABLE: The table you want to migrate, if no column is specified every single column will be migrated, also the default charset of the table is altered.
  • COLUMN: The column to be migrated (needs TABLE defined). It will only migrate that column definition.
  • COLLATION: The collation (utf8mb4_unicode_520_ci by default)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/magec/utf8mb4rails.

License

The gem is available as open source under the terms of the MIT License.