Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

MySQL tables, Windows/Linux differences

Go to End

7 Posts   7199 Views


Community Member, 712 Posts

24 May 2008 at 7:08pm

Hi all,

Just a quick question. I just pulled a site from work (windows environment) to my home machine (Ubuntu) and rebuilt. Can someone explain why in the Linux environment, the table names for classes were capitalised, but not in the Windows version?

For example, the relationship table "documentsgroup_mydocuments" in windows became "DocumentsGroup_MyDocuments" when built in linux.

Obviously, if you're developing on one platform this isn't a problem, but I'm switching between the two and it's a major hassle to go through and switch case depending on the machine.



Community Member, 20 Posts

24 May 2008 at 7:28pm

This is because Silverstripe uses partially uppercase table names, but in Windows these are automatically converted to lowercase by MySQL.


Community Member, 9 Posts

30 May 2008 at 11:36pm

That's the reason why I wrote the following php-script. It translates a database
export-file from lowercase to camelcase and vice versa using an export-file
of the destination database as template for translation.
See attached php-script.
Run the scipt with '?help=1' for an explanation.


Community Member, 20 Posts

31 May 2008 at 3:08pm

Cool, that's a big help.


Community Member, 20 Posts

24 July 2008 at 7:47pm

OK, just ran into the same problem again, but this time I took a few minutes to work on the /db/build function. This fixes the problem without the need for any extra scripts:
In sapphire/core/model/MySQLDatabase.php, edit the following function (I just added lines 3-6):

public function checkAndRepairTable($tableName) {
  if(!$this->runTableCheckCommand("CHECK TABLE `$tableName`")) {
    if($this->runTableCheckCommand("CHECK TABLE `".strtolower($tableName)."`")) {
      Database::alteration_message("Table $tableName: repaired","repaired");
      return $this->renameTable(strtolower($tableName),$tableName);
    Database::alteration_message("Table $tableName: repaired","repaired");
    return $this->runTableCheckCommand("REPAIR TABLE `$tableName` USE_FRM");
  } else {
    return true;

Now, whenever the database is copied from a Windows to a Linux machine, just run /db/build and the tables are renamed properly.


Community Member, 9 Posts

6 August 2008 at 6:18pm

Ok, I will try this next time when I need to move a DB.


Community Member, 12 Posts

15 August 2008 at 2:28am

Edited: 15/08/2008 2:28am

This problem happened to me as well. I manually renamed the table names in my sql file that were affected and then added Blynx's code and it worked! Thanks Blynx.