On Wednesday, July 19, 2017 at 1:09:54 PM UTC-7, Greg Gilbert wrote:
>
> Just a quick question: when writing a migration, how would you define the 
> encoding or collation on both the table and the field level? The specific 
> use case is to set a table's encoding to utf8mb4, as well as any VARCHAR or 
> TEXT fields in there as well.
>

create_table(:name, :charset=>'utf8mb4', :collate=>'...'){...}

Unless you need a column charaset/collate different than the table's 
default, that should be good enough.  I think you can specify different 
collate per column using the :collate option, but I don't know if you can 
do that for charset.

You can also set the default charset and collate for a database:

  DB.default_charset = 'utf8mb4'
  DB.default_collate = '...'

Then you don't need to specify them on every create_table call.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to