Now when writing Russian words to the database I get ???????. How to use the migration to change the encoding of the database under the Russian text?
1 answer
No The right way is to describe in the manual that the base should be of the appropriate encoding, set the same encoding in the environment variables and / or in the config, and after that begin to create the base structure by migrations.
The person who created the migration tool could not, for whatever reason, assume that it might be necessary to change the encoding of the database during the development phase of the application. The first, main and last reason why he could not do this - because in the case of automatic migration to a new version of the database, be it stated that you need to change the encoding, all data will go to hell, and hence the meaning in automating such an action through migrations missing.
- Did I understand correctly, the person who will deploy the project, when creating the database, must specify the encoding for the database as specified in the manual? - Fitstd
- one@Fitstd is absolutely true. Usually this is indicated either in the manual, or some default encoding is set (utf blah blah blah), or the database encoding is peeped in the application, since it will always be indicated there or it will be written what is used by default, again. - Stanislav Belichenko
- oneAnd, the latter will be true because practically all the functionality that you can use to connect to the database, in any programming language, will require you in one way or another to specify the encoding of the database. That is why in the case of all kinds of engines and frameworks you will always find this parameter in their config variables. - Stanislav Belichenko