MySQL 1293 error when install migrate
Rapp-colince opened this issue · 5 comments
It fixes when i add defaultValue('0000-00-00 00:00:00') for 'created_at' and 'created_at' column in the
vendor/dmstr/yii2-pages-module/migrations/m150309_153255_create_tree_manager_table.php:53
'created_at' => $this->timestamp()->defaultExpression('NOW()')->defaultValue('0000-00-00 00:00:00'), 'updated_at' => $this->timestamp()->defaultExpression('NOW()')->defaultValue('0000-00-00 00:00:00'),
Which MySQL version do you use?
mysql Ver 14.14 Distrib 5.5.23, for Win32 (x86)
Apply the above migrations? (yes|no) [no]:yes
*** applying m150309_153255_create_tree_manager_table
> create table dmstr_page ...Exception 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 1293 Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
The SQL being executed was: CREATE TABLE dmstr_page
(
id
int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
root
int(11) NOT NULL DEFAULT 0,
lft
int(11) NOT NULL,
rgt
int(11) NOT NULL,
lvl
smallint(6) NOT NULL,
page_title
varchar(255),
name
varchar(60) NOT NULL,
name_id
varchar(255) NOT NULL,
slug
varchar(255),
route
varchar(255),
view
varchar(255),
default_meta_keywords
varchar(255),
default_meta_description
text,
request_params
text,
owner
int(11) NULL DEFAULT NULL,
access_owner
int(11) NULL DEFAULT NULL,
access_domain
varchar(8) NULL DEFAULT NULL,
access_read
varchar(255) NULL DEFAULT NULL,
access_update
varchar(255) NULL DEFAULT NULL,
access_delete
varchar(255) NULL DEFAULT NULL,
icon
varchar(255) NULL DEFAULT NULL,
icon_type
smallint(6) DEFAULT 1,
active
smallint(6) DEFAULT 1,
selected
smallint(6) DEFAULT 0,
disabled
smallint(6) DEFAULT 0,
readonly
smallint(6) DEFAULT 0,
visible
smallint(6) DEFAULT 1,
collapsed
smallint(6) DEFAULT 0,
movable_u
smallint(6) DEFAULT 1,
movable_d
smallint(6) DEFAULT 1,
movable_l
smallint(6) DEFAULT 1,
movable_r
smallint(6) DEFAULT 1,
removable
smallint(6) DEFAULT 1,
removable_all
smallint(6) DEFAULT 0,
created_at
timestamp DEFAULT NOW(),
updated_at
timestamp DEFAULT NOW()
)'
in W:\domains\localhost\protected\vendor\yiisoft\yii2\db\Schema.php:636
Error Info:
Array
(
[0] => HY000
[1] => 1293
[2] => Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
)
//--------------------------------
mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.5.50 |
+-----------+
1 row in set (0.04 sec)
Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
only one column
Hopefully nobody is using mysql5.5 anymore...
https://dev.mysql.com/doc/relnotes/mysql/5.6/en/news-5-6-5.html#mysqld-5-6-5-data-types