Skip to content
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

Add charset/collation to xPDOManager->getColumnDef #175

Open
Mark-H opened this issue Feb 7, 2020 · 4 comments
Open

Add charset/collation to xPDOManager->getColumnDef #175

Mark-H opened this issue Feb 7, 2020 · 4 comments

Comments

@Mark-H
Copy link
Collaborator

Mark-H commented Feb 7, 2020

Force the chosen charset instead of relying on unreliable server behavior.

@wshawn
Copy link

wshawn commented Feb 17, 2020

I concur. Please fix this. I have mentioned this issue several times over the years. I have to manually go into the database tables after xPDO creates them and alter the coalition when I am collecting UTF-8 data which may get obliterated otherwise. As json_encode requires UTF8, it only makes sense the database content should reflect it, especially with the MySQL JSON data type.

@opengeek
Copy link
Member

Can we clarify this? At the current time, xPDO will always default to the database container's charset/collation when creating a table column. Are you saying we need to allow the definition of collation per column, or that xPDO should ignore the actual collation defined in the database container in favor of the one defined in a specific connection to it? I hesitate to allow a single connection to the database define the table structure. Perhaps defining collation in the schema at the database, table, and/or column level would be a better approach? Then, regardless of the connection charset/collation, the databases, tables, and columns would be created with the defined charset/collation. Then again, even this presents the issue of not allowing projects that use xPDO to allow flexibility in defining the charset/collations being used. But it might allow overrides where it is critical, like on columns containing JSON data.

@Mark-H
Copy link
Collaborator Author

Mark-H commented Feb 25, 2021

The problem I'd like to see solved is that MODX users are asked to choose a charset/collation in the setup, but that said charset/collation is then not used in creating tables down the road by the xPDOManager creating additional tables.

That leads to people being adamant they selected a utf8/utf8mb4 charset on setup, but their latin1-configured shared server created tables for extras as latin1 because getColumnDef doesn't specify what was explicitly selected. Comes up like every other week or so in support.

Off-hand I'm not quite sure what (if anything) happens in xPDO with the selected charset in the MODX setup but it seems like that should be getting passed around somewhere to be used.

@wshawn
Copy link

wshawn commented Feb 25, 2021

What @Mark-H said. That was my original point of the post. It also, seems to grab only one charset per table. My only workaround has been to manually change the tables after creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants