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)
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
Changed 4 years ago by Lazlo
comment:4 follow-up: ↓ 5 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.
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.

Ie created a patch for this. See attachment.