1 |
I'm not a PHP programmer but I'll try to explain my problem. |
2 |
I've create table in my php database: |
3 |
|
4 |
DROP TABLE IF EXISTS visual_verify_code; |
5 |
CREATE TABLE visual_verify_code ( |
6 |
oscsid varchar(32) NOT NULL, |
7 |
code varchar(6) NOT NULL, |
8 |
dt TIMESTAMP(12) NOT NULL DEFAULT NOW(), |
9 |
PRIMARY KEY (oscsid) |
10 |
); |
11 |
|
12 |
It worked OK, after few days I backup my database and try to restore it, but it keeps complaining on the "dt": |
13 |
ERROR 1067 (42000) at line 38009: Invalid default value for 'dt' |
14 |
|
15 |
so the database is dropped but never restored. The backup data base contain: |
16 |
|
17 |
create table visual_verify_code ( |
18 |
oscsid varchar(32) not null , |
19 |
code varchar(6) not null , |
20 |
dt timestamp default 'CURRENT_TIMESTAMP' not null , |
21 |
PRIMARY KEY (oscsid) |
22 |
); |
23 |
|
24 |
so the difference is: |
25 |
|
26 |
dt TIMESTAMP(12) NOT NULL DEFAULT NOW(), |
27 |
vs |
28 |
dt timestamp default 'CURRENT_TIMESTAMP' not null , |
29 |
|
30 |
If I change in backup database the line to: "dt TIMESTAMP(12) NOT NULL DEFAULT NOW()," |
31 |
I can restore it without problems. |
32 |
|
33 |
Why is it doing it? |
34 |
In "dt" table structure the "default" has option: |
35 |
- None |
36 |
- As Defined: |
37 |
- NULL |
38 |
- CURRENT_TIMESTAMP |
39 |
|
40 |
If I change setting from "CURRENT_TIMESTAMP" to any of the above will it help restore it correctly? |
41 |
|
42 |
-- |
43 |
Joseph |