verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

One of Comments’s migrations failed

jsellerIPOP opened this issue · comments

Hey

I am getting the following error when trying to upgrade from Craft 2 to Craft 3:

Database Exception: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '0000-00-00 00:00:00' for column 'commentDate' at row 1
The SQL being executed was: ALTER TABLE craft_comments_comments ADD commentDate datetime(0) NOT NULL AFTER userAgent

Migration: verbb\comments\migrations\m180826_000000_add_comment_date_column

Please can you assist?

Hmmm, so that new column should be adding the values for each comment from their dateCreated column. Can you confirm if there are any values with this as their value? That itself would be an issue for Craft 2, which handles the dateCreated column.

Yes there are values in the database under the dateCreated column. I can't see any rows for commentDate, not sure if it's supposed to. Any help appreciated

So commentDate will be a new column that the migration adds, but it copies across the value from the dateCreated column. I think you might have 0000-00-00 00:00:00 as the value for some comments in the dateCreated column.

@jsellerIPOP @engram-design Having the same issue. Also, no reference to 0000-00-00 00:00:00

Hmmm, I'll have to spin up a Craft 2 site to test this.

Can either of you comment in your MySQL versions? I've just done 5 migrations from Craft 2 without issue. I've added a fix that might help. To get the fix early, change your verbb/comments requirement in composer.json to:

"require": {
  "verbb/comments": "dev-craft-3 as 1.8.7",
  "...": "..."
}

Then run composer update.

@jsellerIPOP I've just pushed another more direct fix for this, which might help. Running composer update again will pull the latest change.

@jsellerIPOP Sorry for the issues. I just can't replicate it on my setup, otherwise I'd be able to confirm more definitively.

If you're up for it, and able to (and you're okay with it) you're welcome to send your Craft 2 database to web at verbb.io and I can see if I can replicate your issue.

Was this issue ever resolved? Currently facing the same issue migrating from craft2 -> 3

@isaacwingate Happy to look into it, but we weren't able to replicate it with a number of Craft 2 installs. If you're able to, sending your database at Craft 2 to support@verbb.io would be great so we can see what state the database is in before the upgrade.