Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL文にON UPDATE NOW()があるとparse errorが起きます。 #77

Open
JunyaFukagawa opened this issue Mar 22, 2019 · 1 comment
Open

Comments

@JunyaFukagawa
Copy link

old.sql

create table `test_log` (
  `test_log_id` BIGINT not null AUTO_INCREMENT
  , `updated_at` DATETIME default NOW() ON UPDATE NOW()
)

new.sql

create table `test_log` (
  `test_log_id` BIGINT not null AUTO_INCREMENT
  , `log_status` INT not null
  , `updated_at` DATETIME default NOW() ON UPDATE NOW() 
)

error message

2019/03/22 20:19:50 failed to parse "from" create table `test_log` (
  `test_log_id` BIGINT not null AUTO_INCREMENT
  , `updated_at` DATETIME default NOW() ON UPDATE NOW()
)
: parse error: cannot apply coloptSize, coloptDecimalSize, coloptDecimalOptionalSize, coloptEnumValues, coloptSetValues at line 3 column 53
    "at` DATETIME default NOW() ON UPDATE NOW" <---- AROUND HERE
@soh335
Copy link
Member

soh335 commented Mar 25, 2019

https://dev.mysql.com/doc/refman/5.6/ja/timestamp-initialization.html

これを見ていると on update の後に来るのは

CURRENT_TIMESTAMP()、NOW()、LOCALTIME、LOCALTIME()、LOCALTIMESTAMP、および LOCALTIMESTAMP() です。

という感じですかね。default の後もこれを受け付けられそう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants