{"action":"reopened","issue":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/5779","repository_url":"https://api.github.com/repos/silverstripe/silverstripe-framework","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/5779/labels{/name}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/5779/comments","events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/5779/events","html_url":"https://github.com/silverstripe/silverstripe-framework/issues/5779","id":164233592,"number":5779,"title":"Clarify docs for table case sensitivity on Windows","user":{"login":"silbinarywolf","id":3859574,"avatar_url":"https://avatars1.githubusercontent.com/u/3859574?v=4","gravatar_id":"","url":"https://api.github.com/users/silbinarywolf","html_url":"https://github.com/silbinarywolf","followers_url":"https://api.github.com/users/silbinarywolf/followers","following_url":"https://api.github.com/users/silbinarywolf/following{/other_user}","gists_url":"https://api.github.com/users/silbinarywolf/gists{/gist_id}","starred_url":"https://api.github.com/users/silbinarywolf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silbinarywolf/subscriptions","organizations_url":"https://api.github.com/users/silbinarywolf/orgs","repos_url":"https://api.github.com/users/silbinarywolf/repos","events_url":"https://api.github.com/users/silbinarywolf/events{/privacy}","received_events_url":"https://api.github.com/users/silbinarywolf/received_events","type":"User","site_admin":false},"labels":[{"id":395787592,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/affects/v3","name":"affects/v3","color":"d4c5f9","default":false},{"id":34485690,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels/type/docs","name":"type/docs","color":"02d7e1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-07-07T05:40:10Z","updated_at":"2018-04-15T05:16:47Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Recently hit an issue where I'm developing on Windows alongside another Windows developer who had broken tables but was doing mostly frontend/data-entry work.\n\nMight be nice to add a ?force_rename param to /dev/build or something to fix this when using 'lower_case_table_names=2' with Windows. (Doing \"ALTER TABLE sitetree_live RENAME SiteTree_Live\" has no effect as it can't tell the difference)\n\n```\npublic function checkAndRepairTable($tableName) {\n        // Flag to ensure we only send the warning about PDO + native mode once\n        static $pdo_warning_sent = false;\n\n        // If running PDO and not in emulated mode, check table will fail\n        if($this->database->getConnector() instanceof PDOConnector && !PDOConnector::is_emulate_prepare()) {\n            if (!$pdo_warning_sent) {\n                $this->alterationMessage('CHECK TABLE command disabled for PDO in native mode', 'notice');\n                $pdo_warning_sent = true;\n            }\n\n            return true;\n        }\n\n        // CODE HERE\n        $this->renameTable(strtolower($tableName), $tableName.'_renameplease');\n        $this->renameTable($tableName.'_renameplease', $tableName);\n        // CODE HERE\n\n        // Perform check\n        if (!$this->runTableCheckCommand(\"CHECK TABLE \\\"$tableName\\\"\")) {\n            if ($this->runTableCheckCommand(\"CHECK TABLE \\\"\" . strtolower($tableName) . \"\\\"\")) {\n                $this->alterationMessage(\n                    \"Table $tableName: renamed from lowercase\",\n                    \"repaired\"\n                );\n                return $this->renameTable(strtolower($tableName), $tableName);\n            }\n\n            $this->alterationMessage(\n                \"Table $tableName: repaired\",\n                \"repaired\"\n            );\n            return $this->runTableCheckCommand(\"REPAIR TABLE \\\"$tableName\\\" USE_FRM\");\n        } else {\n            return true;\n        }\n    }\n```\n"}}
{"actor":{"display_login":"silbinarywolf"}}