JodliDev / calendar

GNU Affero General Public License v3.0
16 stars 12 forks source link

[installation] MySQL requests do not use table prefix #33

Closed gqdc closed 1 year ago

gqdc commented 1 year ago

Hi,

I follow the installation instructions, but, it fails when runing plugins/calendar/drivers/database/SQL/mysql.initial.sql with the message :

Creating database schema... ERROR: [1146] Table 'roundcube_dev.system' doesn't exist (SQL Query: REPLACE INTO system (name, value) VALUES ('calendar-database-version', '2015022700'))
[FAILED]
ERROR: [1146] Table 'roundcube_dev.system' doesn't exist

Indeed, all my roundcube's tables has a prefix. So the correct request must be :

REPLACE INTO **prefix_**system (name, value) VALUES ('calendar-database-version', '2015022700'))

EDIT : All the other resquests in plugins/calendar/drivers/database/SQL/mysql.initial.sql and plugins/calendar/drivers/caldav/SQL/mysql.initial.sql are wrong.

gqdc commented 1 year ago

I manually edited the requests with my table prefix, and everything went well.

matikij commented 5 months ago

The proper fix here is to not use REPLACE INTO but to use INSERT INTO. REPLACE INTO is not recognized by roundcube's rcutil::fix_table_names and thus the prefix is not added. Since this is the initial configuration REPLACE INTO should behave as INSERT INTO anyway.