Opened 4 years ago

Closed 4 years ago

#1485641 closed Bugs (fixed)

Incorrect Mysql schema

Reported by: ghostks Owned by:
Priority: 5 Milestone: 0.2.1
Component: Database Version: 0.2-beta
Severity: normal Keywords:
Cc:

Description

You are using:

datetime NOT NULL DEFAULT '0000-00-00 00:00:00'

default values for datetime fields, but it's incorrect. Some Mysql servers which are not using STRICT syntax possibly will execute it but all others will deny you from executing such malformed query. Correct one is:

datetime NOT NULL DEFAULT '1000-01-01 00:00:00'

"The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'."
http://dev.mysql.com/doc/refman/5.0/en/datetime.html

Attachments (4)

roundcube_mysql.initial.patch (2.5 KB) - added by Lazlo 4 years ago.
roundcube_mysql.update.patch (955 bytes) - added by Lazlo 4 years ago.
roundcube_mysql.initial.2.patch (2.3 KB) - added by Lazlo 4 years ago.
Patch with no DEFAULT value
roundcube_mysql.update.2.patch (715 bytes) - added by Lazlo 4 years ago.
Patch with no DEFAULT value

Download all attachments as: .zip

Change History (10)

comment:1 Changed 4 years ago by ghostks

  • Component changed from Addressbook to Database

comment:2 Changed 4 years ago by alec

  • Milestone changed from later to 0.2-stable

comment:3 Changed 4 years ago by Lazlo

Ie created a patch for this. See attachment.

Changed 4 years ago by Lazlo

comment:4 follow-up: Changed 4 years ago by alec

For me (a postgres user) it looks strange. It wouldn't be better to use DEFAULT NULL?

Changed 4 years ago by Lazlo

comment:5 in reply to: ↑ 4 Changed 4 years ago by Lazlo

Replying to alec:

For me (a postgres user) it looks strange. It wouldn't be better to use DEFAULT NULL?

You can't drop the NOT NULL (e.g. you're not allowed to add cache entries without timestamp), but you can drop the DEFAULT.

Changed 4 years ago by Lazlo

Patch with no DEFAULT value

Changed 4 years ago by Lazlo

Patch with no DEFAULT value

comment:6 Changed 4 years ago by alec

  • Resolution set to fixed
  • Status changed from new to closed

First patch applied in [37974e24] as more safe.

Note: See TracTickets for help on using tickets.