Am 19.06.2013 15:36, schrieb Paul J Stevens:
> On 06/19/2013 01:02 PM, Reindl Harald (mobile) wrote:
> 
>> Uhm wouldn't it not be a good idea at least verify the scheme and
>> spit out a big fat warning to the syslog and in general give
>> dbmail-util a switch to apply scheme changes which should be
>> called after any dbmail update instead deal with SQL dumps?
> 
> How do you propose we do that?

what about having a meta-table which could be created
at startup if it does not exist containing the version
of the sql-scheme by a increasing number

if you make any change to the scheme raise the internal
number, select what is currently applied in the metatable
and the needed changes should be pretty clear i think
_________________________________________

the hard way:

parse the output of "show fields", "show create view" and
"show create table" - in case of the missing "sortfield"
it would have been enough to look if it exists

MariaDB [dbmail]> show fields from dbmail_datefield;
+----------------+---------------------+------+-----+---------+-------+
| Field          | Type                | Null | Key | Default | Extra |
+----------------+---------------------+------+-----+---------+-------+
| physmessage_id | bigint(20) unsigned | NO   |     | 0       |       |
| datefield      | datetime            | YES  |     | NULL    |       |
| sortfield      | varchar(255)        | YES  |     | NULL    |       |
+----------------+---------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

MariaDB [dbmail]> show fields from dbmail_mailboxes;
+---------------+---------------------+------+-----+---------+----------------+
| Field         | Type                | Null | Key | Default | Extra          |
+---------------+---------------------+------+-----+---------+----------------+
| mailbox_idnr  | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| owner_idnr    | bigint(20) unsigned | NO   | MUL | 0       |                |
| name          | varchar(255)        | NO   | MUL |         |                |
| seen_flag     | tinyint(3) unsigned | NO   |     | 0       |                |
| answered_flag | tinyint(3) unsigned | NO   |     | 0       |                |
| deleted_flag  | tinyint(3) unsigned | NO   |     | 0       |                |
| flagged_flag  | tinyint(3) unsigned | NO   |     | 0       |                |
| recent_flag   | tinyint(3) unsigned | NO   |     | 0       |                |
| draft_flag    | tinyint(3) unsigned | NO   |     | 0       |                |
| no_inferiors  | tinyint(3) unsigned | NO   |     | 0       |                |
| no_select     | tinyint(3) unsigned | NO   |     | 0       |                |
| permission    | tinyint(3) unsigned | YES  |     | 2       |                |
| seq           | bigint(20) unsigned | NO   | MUL | 0       |                |
+---------------+---------------------+------+-----+---------+----------------+
13 rows in set (0.00 sec)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to