Open pdurkim opened 6 years ago
can you be more precise in your description of the problem and how it relates to apartment? your steps to reproduce are somewhat lacking.
MySQL DB character set = utfb8mb4 and collate = utf8mb4_bin
how are these configured? the error you quote seems to suggest a character set of 'utf8'. is apartment not passing this through correctly?
I'm seeing the same issue, e.g. having this in config/database.yml
:
adapter: mysql2
encoding: utf8mb4
collation: utf8mb4_unicode_ci
Produces this error when attempting to create a tenant:
Mysql2::Error: COLLATION 'utf8mb4_unicode_ci' is not valid for CHARACTER SET 'utf8': CREATE DATABASE `foo` DEFAULT CHARACTER SET `utf8` COLLATE `utf8mb4_unicode_ci
This is fixed by providing charset: utf8mb4
in config/database.yml
.
Steps to reproduce
MySQL DB character set = utfb8mb4 and collate = utf8mb4_bin
Expected behavior
Create the tenant in DB
Actual behavior
Apartment::Tenant.create(tenant_name) results in following error:
"Error while creating tenant development_tenant_name: Mysql2::Error: COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'utf8': CREATE DATABASE 'development_tenant_name' DEFAULT CHARACTER SET 'utf8' COLLATE 'utf8mb4_bin'"
System configuration
Database: MySQL 0.4.6
Apartment version: 2.2.0
Apartment config (in
config/initializers/apartment.rb
or so):use_schemas
:false
Rails (or ActiveRecord) version: 5.0.2
Ruby version: