verbb / comments

A Craft CMS plugin for managing comments directly within the CMS.
Other
137 stars 33 forks source link

One of Comments’s migrations failed #231

Closed jsellerIPOP closed 2 years ago

jsellerIPOP commented 3 years ago

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?

engram-design commented 3 years ago

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.

jsellerIPOP commented 3 years ago

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

engram-design commented 3 years ago

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 commented 3 years ago

I have double checked and there is no reference to 0000-00-00 00:00:00 in that column. What would be the best way to get around this? Remove the content

Cheers

Jonny Seller // Co-founder & Director

Web Development

iPOP Digital www.ipopdigital.com @.***

Sign up for e-news updates https://ipopdigital.us9.list-manage.com/subscribe?u=e8229c921ee3bd05d260b5ceb&id=1960579327

O. 01534 734 508

1st Floor • Ingouville House • Ingouville Lane • St Helier • Jersey • JE2 4SG

On Thu, 24 Jun 2021 at 03:08, Josh Crawford @.***> wrote:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/verbb/comments/issues/231#issuecomment-867277292, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2SVJA76BPXHYHZ4J67ABLTUKHSXANCNFSM47BYKB2Q .

chill0216 commented 3 years ago

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

engram-design commented 3 years ago

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

engram-design commented 3 years ago

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 commented 3 years ago

Hi Josh

Thanks for your assistance with this. I have added this to composer and run the update but unfortunately, I am still experiencing the same issue.

My MySQL version is 5.7.26

Many thanks,

Jonny Seller // Co-founder & Director

Web Development

iPOP Digital www.ipopdigital.com @.***

Sign up for e-news updates https://ipopdigital.us9.list-manage.com/subscribe?u=e8229c921ee3bd05d260b5ceb&id=1960579327

O. 01534 734 508

1st Floor • Ingouville House • Ingouville Lane • St Helier • Jersey • JE2 4SG

On Sun, 27 Jun 2021 at 06:52, Josh Crawford @.***> wrote:

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.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/verbb/comments/issues/231#issuecomment-869106302, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2SVJC7LGZJ5CYOQXLZHC3TU24ABANCNFSM47BYKB2Q .

engram-design commented 3 years ago

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

jsellerIPOP commented 3 years ago

Hey Josh,

This is still causing the same issue. I might see if the client needs all the old comments and remove them from the table.

Thanks for your help

Jonny Seller // Co-founder & Director

Web Development

iPOP Digital www.ipopdigital.com @.***

Sign up for e-news updates https://ipopdigital.us9.list-manage.com/subscribe?u=e8229c921ee3bd05d260b5ceb&id=1960579327

O. 01534 734 508

1st Floor • Ingouville House • Ingouville Lane • St Helier • Jersey • JE2 4SG

On Wed, 30 Jun 2021 at 12:13, Josh Crawford @.***> wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/verbb/comments/issues/231#issuecomment-871312102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2SVJAMRU3NTTHDWFJPWLTTVL34XANCNFSM47BYKB2Q .

engram-design commented 3 years ago

@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.

isaacwingate commented 8 months ago

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

engram-design commented 8 months ago

@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.