espocrm / ext-template

Template repository for EspoCRM extensions
Creative Commons Zero v1.0 Universal
31 stars 17 forks source link

Added database collation to default configuration #17

Closed bandtank closed 1 year ago

bandtank commented 1 year ago

As part of the development process, I have needed to drop and create the database using build.js from the extension-tools repository. The collation value is required. There will be an accompanying pull request for the other repository.

yurikuzn commented 1 year ago

We don't have 'collation' parameter as far as I know.

bandtank commented 1 year ago

That is true. Unfortunately, creating the database as part of the extension-tools repo requires a value for this. On a related note, it might be useful to add collation to the list of parameters for Espo because it is important for the consistency of the database installation.

yurikuzn commented 1 year ago

I got the intention now.

yurikuzn commented 1 year ago

Espo does not have the functionality that creates database. PostgreSQL does not have collation parameter. Hence no need to have this parameter in Espo. I'm not sure whether the database/schema collation has any effect on column collations, they are created with a proper collation by Espo upon rebuild.

yurikuzn commented 1 year ago

Maybe I'm mistaken regarding creation functionality. During installation maybe it can create. Didn't use it for long, don't remember.

bandtank commented 1 year ago

My intention isn't to change the Espo installer. This is only for development purposes, which meanas the developer might need access to the collation value during the databaseReset() process. If you do not specify a collation, mysql defaults to utf8mb4_0900_ai_ci, which is not what I would have expected. Regardless, I understand if you don't want to merge this and the databaseReset() functionlaity. I will keep the code in my fork and merge around it when I get updates to both repositories. I just thought this might be useful for other developers.

yurikuzn commented 1 year ago

When it defaults utf8mb4_0900_ai_ci, does it cause any problems?

bandtank commented 1 year ago

I have not encountered a problem yet and I use Espo for many hours per day, so probably not. It leaves the developer/installer to the mercy of MySQL's defaults, though. utf8mb4_0900_ai_ci is new as of MySQL 8.0, so some people may be unfamiliar with it.

It is possible to add the databaseReset functionality without the collation variable. Removing the last part of the string where the collation is set causes the collation to default to utf8mb4_0900_ai_ci, which seems fine if you don't want to add the collation parameter.

yurikuzn commented 1 year ago

As far as I know, the database collation value should not have any effect on Espo, hence we can neglect it.