Chao Lam

Working on the next small things …

Default Active Record tables to utf8mb4 encoding

leave a comment »

I found several articles on how to convert existing rails tables to support 4-byte unicode characters including emojis but didn’t find one talking about how to create a new table.

So, here’s the code I used:

create_table :twitter_users, {options:"DEFAULT CHARSET=utf8mb4"} do |t|
...
t.timestamps
end

Written by Pseudonymous

February 14, 2019 at 10:14 pm

Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: