Ticket #2476 (new defect)

Opened 2 months ago

Last modified 1 month ago

Convert table names to lowercase

Reported by: Blynx Assigned to: sminnee
Type: defect Priority: critical
Milestone: 2.2.3 Component: Sapphire Framework
Version: 2.2.2-rc2 Severity: medium effort / impact
Keywords: MySQL, table names, lowercase Cc:
Due date: Harvest Task: (Unknown)
Invoice sent to client: 0 Hours:

Description

I've just tried to copy my local SS installation to a hosted webspace and ran into a huge MySQL problem. This problem occurs when a database from a Windows based MySQL server is copied to a *Unix based server, because of the different handling of table names: In Windows, all table names are automatically converted to lowercase, whereas in *Unix they are case sensitive.

The only solution (as I had no access to the MySQL configuration to set the "lower_case_table_names" option) was to rename all tables by hand, which is quite annoying as the naming is a little inconsistent: The *_lang and *_versions extensions start with lowercase letters, whereas all other extensions like *_Live start with uppercase letters.

After a little search in the forum it turns out that I'm not the only one having this problem, and so far there is no real solution other than installing from scratch.

The optimal solution for that would be to switch to lowercase table names in general, which would create an identical database across all platforms. Unfortunalety, this would mean that every query has to be rewritten to only use lowercase table names.

Alternately, an extension to the /db/build function could be helpful: Instead of failing when a table is not found, check for the same table in lowercase letters and (if existing) rename it. This would not eliminate the cause of the problem, but retain compatibility with the existing code while providing a quick and easy way to move existing installations to a new server.

Attachments

Change History

Changed 1 month ago by Blynx

Maybe the script posted in http://www.silverstripe.com/site-builders-forum/flat/77595?showPost=80780#post80293 would be of some help with this.

Note: See TracTickets for help on using tickets.