-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set collation to model? #7110
Comments
|
this seem is black magic,may be add chartset is right way. @MrVoler |
This feels extremely hacky and it has to be done for every single field. |
For anyone coming here looking for a fix https://stackoverflow.com/questions/41666820/node-sequelize-mysql-how-to-define-collation-and-charset-to-models explains how to do it on a db level.
|
Hey! in documentation i found this
|
`var basename = path.basename(__filename); if (config.use_env_variable) { When i set collate like on example above, this does not work for me, can anyone help me? Thank you |
Hi !, copy this in your config.json
|
it does not work for me |
@tzs007 What about the suggestion by tvl83 above? Does it work for you? |
The problem with these solutions is that they give a database wise configuration. :( Can anybody help? |
Ah, I understand. Thanks! I will reopen this. |
Infact, The var sequelize = new Sequelize('database', 'username', 'password', {
define: {
charset: 'utf8',
collate: 'utf8_general_ci', // this work
},
dialectOptions: {
collate: 'utf8_general_ci', // not work
},
}) |
I have a problem with this : I need to specify a collation on a single column, otherwise the |
It does for me, can you post your code? |
I spent a lot of time to figure out how to make only one column case sensitive, and finally I found a solution, here is the solution: User.init(
{
id: {
type: DataTypes.STRING({ binary: true }),
primaryKey: true,
},
name: {
type: DataTypes.STRING,
allowNull: false,
},
},
{
sequelize: database,
tableName: 'users',
timestamps: false,
}
); P.S. i'm using class Models, but |
i have set
but get an error like this
i use define for my view ( not a table ) , mostly i force / override set on view query with
|
Hey!
I am using sequelize and sequelize-cli with mysql.
Trying to create a table, i stuck with a problem - i cant find where to set collation to specific model.
When instantiate sequelize object i did defined collation and charset, but it seem to dosent respect that.
What do you expect to happen?
I want to set collation to 'utf-8'.
What is actually happening?
the collation is by default 'latin1_swedish_ci' for each column that created in table,
Dialect: mysql
Sequelize version: 3.28.x
The text was updated successfully, but these errors were encountered: