Hello list,
i wrote a short script for the creation of mysql tables.
it reads all table definitions from a php array included earlier, then checks if the tables exist, after that it checks each field if it matches the desired definition. If anything differs it executes previously declared sql queries to correct it. It takes care of multiple indexes also.
Just drop the two files in the attachment in the folder SQL/ and execute: php mysql_setup.php (it should work also being called from your browser)
You can test it with deleting/changing some fields, or whole tables, run the script and check if it recreates the tables correctly :-)
what it cannot do is changing values in rows, like the change
UPDATE contacts
SET del
=0 WHERE del
=1;
(i even see the problem of multiple executions of that query...)
also note, that changing field types can cause data loss (think of
changing a varchar to int, the colum values of each row would be lost)
As of now i just created the definitions for the tables: users, cache i will add the other tables later :-)
You may run the script as often as you wish, it _SHOULD_ (at least i hope so ;-) ) only change wrong tables/fields. So if later new tables, fields are added or changed, only the file mysql_table_defs.php needs to be updated.
Kind regards
Florian Sperber
P.S. what about changing table types from MyISAM to InnoDB?
Would you or anyone else be interested in fixing up a general installer for roundcube? It's a set of php files that check permissions, get config input and write out the cfg file. May ease installation and permissions/db/etc problems.
I had pulled it from a limboserver install, but haven't had the time to integrate it.
-- Rob