Migration "RPadVotes_from_0_8" fails due to hard-coded table name
I just installed the master-branch of framadate. As I am using a dedicated database I changed the tablename_prefix to ''. With this the Migration fails with a
Uncaught exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not found: 1146 Table 'framadate_db.fd_vote' doesn't exist' ...
This is due to the fact that in app/classes/Framadate/Migration/RPadVotes_from_0_8.php
the name of the vote-table is hard-coded and Utils::table('vote')
is not used.
I was able to make this work with these changes to that file:
--- a/app/classes/Framadate/Migration/RPadVotes_from_0_8.php
+++ b/app/classes/Framadate/Migration/RPadVotes_from_0_8.php
@@ -52,13 +52,13 @@ class RPadVotes_from_0_8 implements Migration {
}
private function rpadVotes($pdo) {
- $pdo->exec('UPDATE fd_vote fv
+ $pdo->exec('UPDATE '. Utils::table('vote') .' fv
INNER JOIN (
SELECT v.id, RPAD(v.choices, inn.slots_count, \'0\') new_choices
- FROM fd_vote v
+ FROM '. Utils::table('vote') .' v
INNER JOIN
(SELECT s.poll_id, SUM(IFNULL(LENGTH(s.moments) - LENGTH(REPLACE(s.moments, \',\', \'\')) + 1, 1)) slots_count
- FROM fd_slot s
+ FROM '. Utils::table('slot') .' s
GROUP BY s.poll_id
ORDER BY s.poll_id) inn ON inn.poll_id = v.poll_id
WHERE LENGTH(v.choices) != inn.slots_count
Is that diff OK with you or would you like to make me a merge request?
Greetings Hermann